github clerk/javascript @clerk/astro@2.8.0

latest releases: @clerk/types@4.92.0, @clerk/clerk-js@5.99.0, @clerk/fastify@2.4.37...
5 months ago

Minor Changes

  • Introduce treatPendingAsSignedOut option to getAuth and auth from clerkMiddleware (#5757) by @LauraBeatris

    By default, treatPendingAsSignedOut is set to true, which means pending sessions are treated as signed-out. You can set this option to false to treat pending sessions as authenticated.

    // `pending` sessions will be treated as signed-out by default
    const { userId } = getAuth(req, locals);
    // Both `active` and `pending` sessions will be treated as authenticated when `treatPendingAsSignedOut` is false
    const { userId } = getAuth(req, locals, { treatPendingAsSignedOut: false });
    clerkMiddleware((auth, context) => {
      const { redirectToSignIn, userId } = auth({ treatPendingAsSignedOut: false });
    
      // Both `active` and `pending` sessions will be treated as authenticated when `treatPendingAsSignedOut` is false
      if (!userId && isProtectedRoute(context.request)) {
        return redirectToSignIn();
      }
    });

Patch Changes

Don't miss a new javascript release

NewReleases is sending notifications on new releases.