Express server-side changes
Before starting this guide, please complete the Client-side changes.
Middleware
Express middleware been updated to mirror the new useAuth hook on the client-side.
ClerkExpressWithSession
is deprecated and replaced withClerkExpressWithAuth
ClerkExpressRequireSession
is deprecated and replaced withClerkExpressRequireAuth
- Instead of decorating the Request object with a
session
object, it is now decorated with anauth
object that mirrorsuseAuth()
on the client-side.const { userId, sessionId, getToken } = req.auth;
Example usage
import { ClerkExpressRequireAuth } from '@clerk/clerk-sdk-node';app.use(ClerkExpressRequireAuth());app.get('/', (req, res) => {const { userId, sessionId, getToken } = req.auth;// Your handler...})