github clerk/javascript @clerk/nextjs@6.14.0

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

Minor Changes

  • Update useAuth to handle pending sessions as signed-out by default, with opt-out via useAuth({ treatPendingAsSignedOut: false }) or <ClerkProvider treatPendingAsSignedOut={false} /> (#5507) by @LauraBeatris

  • import { clerkMiddleware } from '@clerk/nextjs/server';
    
    export default clerkMiddleware(async auth => {
      const { userId, redirectToSignUp } = await auth();
    
      if (!userId) {
        return redirectToSignUp();
      }
    });
  • Added Content Security Policy (CSP) header generation functionality to clerkMiddleware with support for both standard and strict-dynamic modes. Key features: (#5493) by @jacekradko

    • Automatic generation of CSP headers with default security policies compatible with Clerk requirements
    • Support for both standard and strict-dynamic CSP modes
    • Automatic nonce generation for strict-dynamic mode
    • Ability to add custom directives to match project requirements

    Example

    export default clerkMiddleware(
      async (auth, request) => {
        if (!isPublicRoute(request)) {
          await auth.protect();
        }
      },
      {
        contentSecurityPolicy: {
          mode: "strict-dynamic",
          directives: {
            "connect-src": ["external.api.com"],
            "script-src": ["external.scripts.com"]
          }
        }
      }
    );
    

Patch Changes

Don't miss a new javascript release

NewReleases is sending notifications on new releases.