Packages

@clerk/express

2.1.90 · 14 Nov 2026MIT591.3k / weekRepositoryHomepagenpmAtom feed

Your version

2.1.0

8 Apr 2026Where it was published

2.1.97 is the newest release of 2.x.

In short

1 deprecated2 internal

  • Deprecated

    Deprecated requireAuth() middleware. It will be removed in the next major version.

Security

1 advisory affects 2.1.0; 2.1.6 fixes them

Release note

Minor Changes

  • Deprecated

    Deprecated requireAuth() middleware. It will be removed in the next major version.

    The requireAuth() middleware redirects unauthenticated requests to a sign-in page, which is often unexpected for API routes where a 401 response is more appropriate. Use clerkMiddleware() with getAuth() instead for explicit control over authentication behavior.

    Before (deprecated):

    import { requireAuth } from '@clerk/express';
    
    app.get('/api/protected', requireAuth(), (req, res) => {
      // handle authenticated request
    });

    After (recommended):

    import { clerkMiddleware, getAuth } from '@clerk/express';
    
    app.use(clerkMiddleware());
    
    app.get('/api/protected', (req, res) => {
      const { userId } = getAuth(req);
      if (!userId) {
        return res.status(401).json({ error: 'Unauthorized' });
      }
      // handle authenticated request
    });

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.