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.
ClerkExpressWithSessionis deprecated and replaced withClerkExpressWithAuthClerkExpressRequireSessionis deprecated and replaced withClerkExpressRequireAuth- Instead of decorating the
Requestobject with aSessionobject, it is now decorated with anAuthobject 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... })