Minor Changes
-
Introduce
treatPendingAsSignedOutoption togetAuthandauthfromclerkMiddleware(#5757) by @LauraBeatrisBy default,
treatPendingAsSignedOutis set totrue, which means pending sessions are treated as signed-out. You can set this option tofalseto 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(); } });