Fast Next.js App Router Authentication and User Management with Clerk

Поділитися
Вставка
  • Опубліковано 14 жов 2024

КОМЕНТАРІ • 37

  • @nilsjohansson7335
    @nilsjohansson7335 2 місяці тому +2

    Really nice video! Exactly what I wanted! Really like you are straight to the point and no bs, UA-cam needs more of that! Cheers!

  • @gncfhcnvc
    @gncfhcnvc 4 місяці тому +1

    I would like to see how Clerk manages roles, such as ADMIN and CUSTOMER. It would be an interesting approach.

  • @JohnnyGhanem13
    @JohnnyGhanem13 3 місяці тому +12

    any mewing advice?

  • @jeremyAr
    @jeremyAr 12 днів тому

    So if I only need the userId its better to just use the auth() function? Also is currentUser() function cached?

  • @schuylergood4897
    @schuylergood4897 4 місяці тому +3

    Im encountering an issue where its so difficult to get my users data when they sign up into my database... do you have a tutorial for that?

    • @bookercodes
      @bookercodes 3 місяці тому

      The awesome @hamedbahram has a video on this 🙌🏻 ua-cam.com/video/UTjwyDuVjRM/v-deo.html

    • @whereisartist
      @whereisartist 3 місяці тому +1

      Are you using webhooks to store them?

  • @DanielJosueYatacoBlas
    @DanielJosueYatacoBlas 2 місяці тому

    Does clerk have a role option?
    If so, is it in the free plan?

  • @manishkhandagale26b15
    @manishkhandagale26b15 Місяць тому +1

    After login by clicking signin button, i logged in but sign in button is still showing

  • @eder3232
    @eder3232 3 місяці тому +1

    afterSignInUrl is deprecated, clerk suggests using environment variables instead, i try it bt dont work, can you explain this feature? :C

    • @path8799
      @path8799 3 місяці тому

      Clerk: can only accept and as its children. Any other provided component will be ignored.
      Did you getting this error also?

    • @bookercodes
      @bookercodes 2 місяці тому

      To confirm, you tried adding the following to your .env local?
      NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=localhost:3000/some-path
      You're right afterSignInUrl doesn't exist anymore, but the above is supported and should work. If not, please can you get in touch with more detailed information? clerk.com/contact

  • @azmineabrar235
    @azmineabrar235 4 місяці тому +1

    So, does clerk make all the webpages generated on demand from the server?

    • @bookercodes
      @bookercodes 3 місяці тому

      If you use the Clerk Account Portal, yes, those pages are hosted by Clerk. If you use the AIO components I show in this video, those are hosted by you.

  • @shayaan567
    @shayaan567 Місяць тому

    Constantly getting this error from clerk in the browser console:
    The component cannot render when a user is already signed in, unless the application allows multiple sessions. Since a user is signed in and this application only allows a single session, Clerk is redirecting to the `after SignIn` URL instead. (This notice only appears in development)

    • @bookercodes
      @bookercodes Місяць тому

      Can you try in an incognito window and see what happens?

  • @gncfhcnvc
    @gncfhcnvc 4 місяці тому

    That is a nice implementation

  • @iamgroot494
    @iamgroot494 Місяць тому

    Please help deploying this app to vercel, running into problems on vercel when the app still works on local

  • @timotiusanrez9492
    @timotiusanrez9492 3 місяці тому +1

    how to disable the sign up button as I only want the user to sign in?

    • @bookercodes
      @bookercodes 3 місяці тому

      That is a great question, thank you for commenting.
      To *hide* sign up, tweak the SignIn component's apperance prop. Alternatively, build a custom sign in flow. In either case, remember to disable the Account Portal.
      Hiding is not the same as *disabling* because someone could still find a way to send a backend request and Clerk will allow it.
      To control who can sign up on the backend, check out the Clerk allow list feature. It's perfect for this.

  • @Tanner-cz4bd
    @Tanner-cz4bd 21 день тому

    how to redirect after sign up?

  • @fabianandrespachecozelada4208
    @fabianandrespachecozelada4208 4 місяці тому

    hi, i have a question, if i need bulk a csv file with users data, but i upload to my supabase db first, can i create users after save data in supabase ?

    • @bookercodes
      @bookercodes 3 місяці тому +1

      Yes, that is totally possible, but there are some nuances you should be aware of. If you get in touch on the Clerk Discord with the specifics, the team will be happy to help you work through it.

    • @fabianandrespachecozelada4208
      @fabianandrespachecozelada4208 3 місяці тому +1

      ​@@bookercodes oooh thanks, i will keep in mind

  • @kaushik4941
    @kaushik4941 2 місяці тому

    I have a question how can keep a route public(not protected ) here the code i wrote but its wrong
    import { clerkMiddleware, createRouteMatcher } from '@clerk/nextjs/server';
    const isPublicRoute = createRouteMatcher([
    '/dashboard',
    ]);
    export default clerkMiddleware((request) => {
    // If the request is for a public route, bypass authentication
    if (isPublicRoute(request)) {
    return; // Do nothing and allow access
    }
    });
    export const config = {
    matcher: [
    // Skip Next.js internals and all static files, unless found in search params
    '/((?!_next|[^?]*\\.(?:html?|css|js(?!on)|jpe?g|webp|png|gif|svg|ttf|woff2?|ico|csv|docx?|xlsx?|zip|webmanifest)).*)',
    // Always run for API routes
    '/(api|trpc)(.*)',
    ],
    };

    • @bookercodes
      @bookercodes 2 місяці тому

      createRouterMatcher returns an isPrivateRoute method, not isPublicRoute

  • @web_codder
    @web_codder 2 місяці тому

    Hey i found a bug in clerk app where I can complaint for the bug?

    • @bookercodes
      @bookercodes 2 місяці тому

      You can submit a ticket here: clerk.com/contact

  • @howTo_79
    @howTo_79 3 місяці тому

    8:43 lol you said next authentication instead of clerk authentication
    Next Auth for the win lol

    • @AlexBooker-zj2yv
      @AlexBooker-zj2yv 3 місяці тому

      Authentication with* Next (with Clerk or Next Auth)😄

  • @DanielJosueYatacoBlas
    @DanielJosueYatacoBlas 2 місяці тому +1

    Does clerk have a role option?
    If so, is it in the free plan?

    • @bookercodes
      @bookercodes 2 місяці тому

      Yes!
      With organizations:
      clerk.com/docs/organizations/roles-permissions
      clerk.com/blog/role-based-access-control-with-clerk-orgs
      Without organizations:
      clerk.com/docs/guides/basic-rbac