Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version Packages (alpha-v5) #2449

Merged
merged 1 commit into from
Jan 3, 2024
Merged

Version Packages (alpha-v5) #2449

merged 1 commit into from
Jan 3, 2024

Conversation

clerk-cookie
Copy link
Collaborator

@clerk-cookie clerk-cookie commented Dec 22, 2023

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

main is currently in pre mode so this branch has prereleases rather than normal releases. If you want to exit prereleases, run changeset pre exit on main.

⚠️⚠️⚠️⚠️⚠️⚠️

Releases

@clerk/[email protected]

Patch Changes

@clerk/[email protected]

Patch Changes

@clerk/[email protected]

Patch Changes

@clerk/[email protected]

Patch Changes

@clerk/[email protected]

Patch Changes

[email protected]

Patch Changes

@clerk/[email protected]

Patch Changes

@clerk/[email protected]

Patch Changes

  • Introduce the new clerkMiddleware helper to allow for more flexibility in how Clerk is integrated into your Next.js middleware. Example usage can be found below, for more details, For more details, please see the clerkMiddleware documentation. (#2404) by @nikosdouvlis

    The clerkMiddleware helper effectively replaces the older authMiddleware helper, which is now considered deprecated and will be removed in the next major release.

    1. Protect a route that requires authentication

    import { clerkMiddleware } from '@clerk/nextjs/server';
    
    export default clerkMiddleware(auth => {
      const { userId } = auth().protect();
      // userId is now available for use in your route handler
      // for page requests, calling protect will automatically redirect the user to the sign-in URL if they are not authenticated
      return NextResponse.next();
    });

    2. Protect a route that requires specific permissions

    import { clerkMiddleware } from '@clerk/nextjs/server';
    
    export default clerkMiddleware(auth => {
      const { userId } = auth().protect({ permission: 'org:domains:delete' });
      // userId is now available for use in your route handler
      // for page requests, calling protect will automatically throw a notFound error if the user does not have the required permissions
      return NextResponse.next();
    });

    2. Manually redirect to sign-in URL using the redirectToSignIn helper

    import { clerkMiddleware } from '@clerk/nextjs/server';
    
    export default clerkMiddleware(auth => {
      // If you want more fine-grained control, you can always use the low-level redirectToSignIn helper
      if (!auth().userId) {
        return auth().redirectToSignIn();
      }
    
      return NextResponse.next();
    });

    This commit also introduces the experimental createRouteMatcher helper, which can be used to create a route matcher that matches a route against the current request. This is useful for creating custom logic based on which routes you want to handle as protected or public.

    import { clerkMiddleware, experimental_createRouteMatcher } from '@clerk/nextjs/server';
    
    const isProtectedRoute = experimental_createRouteMatcher([/protected.*/]);
    
    export default clerkMiddleware((auth, request) => {
      if (isProtectedRoute(request)) {
        auth().protect();
      }
    
      return NextResponse.next();
    });
  • Updated dependencies [7ecd6f6ab]:

@clerk/[email protected]

Patch Changes

@clerk/[email protected]

Patch Changes

@clerk/[email protected]

Patch Changes

  • Integrate handshake handling into ClerkExpressWithAuth() and ClerkExpressRequireWith(). If the authenticateRequest() returns a redirect or is in a handshake state, the middlewares will properly handle this and respond accordingly. (#2447) by @BRKalow

  • Updated dependencies [7ecd6f6ab]:

@clerk/[email protected]

Patch Changes

  • Disable telemetry collection when window.navigator.webdriver is defined, indicating traffic from an automation tool. (#2448) by @BRKalow

@clerk/[email protected]

Patch Changes

@github-actions github-actions bot force-pushed the changeset-release/main branch from 3ae7da0 to b4d55e7 Compare January 3, 2024 17:29
@nikosdouvlis nikosdouvlis reopened this Jan 3, 2024
@nikosdouvlis nikosdouvlis merged commit 5d06532 into main Jan 3, 2024
7 checks passed
@nikosdouvlis nikosdouvlis deleted the changeset-release/main branch January 3, 2024 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants