Auth proxy endpoints for Next.js App Router with WorkOS AuthKit.
npm install @workos-inc/node jose zodSet environment variables in .env.local:
WORKOS_API_KEY=sk_...
WORKOS_CLIENT_ID=client_...
Copy the app/api/auth/ directory into your Next.js project:
| Route | Method | Description |
|---|---|---|
/api/auth/authorize |
GET | Redirects to WorkOS AuthKit sign-in |
/api/auth/token |
POST | Exchanges authorization codes and refreshes tokens |
/api/auth/revoke |
POST | Revokes a session |
Point authkit-react-native at your server:
const authStore = createAuthStore({
authorizationEndpoint: "https://your-app.example.com/api/auth/authorize",
tokenEndpoint: "https://your-app.example.com/api/auth/token",
revocationEndpoint: "https://your-app.example.com/api/auth/revoke",
});