Packages

@clerk/nextjs

7.10.2 · 17 Nov 2026MIT4.1M / weekRepositoryHomepagenpmAtom feed

Your version

4.28.0

13 Dec 2023Where it was published

4.31.8 is the newest release of 4.x.

npm marks 4.28.0 as deprecated: A critical security vulnerability that affects versions in the range of >= 4.7.0,< 4.29.3 has been discovered by the Clerk team. Please upgrade immediately to 4.29.3. For more information, refer to clerk.com/changelog/2024-01-12

In short

1 new1 fixed4 internal

Security

1 advisory affects 4.28.0; 4.29.3 fixes them

Release note

Minor Changes

  • Introduce Protect for authorization.

    Changes in public APIs:

    • Rename Gate to Protect

    • Support for permission checks. (Previously only roles could be used)

    • Remove the experimental tags and prefixes

    • Drop some from the has utility and Protect. Protect now accepts a condition prop where a function is expected with the has being exposed as the param.

    • Protect can now be used without required props. In this case behaves as <SignedIn>, if no authorization props are passed.

    • has will throw an error if neither permission or role is passed.

    • auth().protect() for Nextjs App Router. Allow per page protection in app router. This utility will automatically throw a 404 error if user is not authorized or authenticated.

      • inside a page or layout file it will render the nearest not-found component set by the developer

      • inside a route handler it will return empty response body with a 404 status code

Patch Changes

  • Accept redirectUrl as an option for auth().protect().

    For example:

    // Authorization
    auth().protect({ role: 'org:admin' }, { redirectUrl: '/any-page' });
    auth().protect({ permission: 'org:settings:manage' }, { redirectUrl: '/any-page' });
    
    // Authentication
    auth().protect({ redirectUrl: '/any-page' });

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.