packages/create/src/frameworks/react/add-ons/workos
| Name | Last commit message | Last commit date |
|---|---|---|
| .. | ||
README.md
Setting up WorkOS#
This integration uses WorkOS AuthKit's full-stack TanStack Start SDK and requires Node.js 22.11 or newer.
Copy your client ID and API key from the WorkOS dashboard.
Fill in
.env.local:WORKOS_CLIENT_ID=client_... WORKOS_API_KEY=sk_test_... WORKOS_REDIRECT_URI=http://localhost:3000/api/auth/callback WORKOS_COOKIE_PASSWORD=a-random-value-at-least-32-characters-long WORKOS_API_HOSTNAME=api.workos.comOn the dashboard's Redirects page, add
http://localhost:3000/api/auth/callbackas a redirect URI andhttp://localhost:3000/api/auth/sign-inas the sign-in endpoint.Start the app and visit
/demo/workos.
What's wired up#
authkitMiddleware()manages the encrypted server-side session insrc/start.ts./api/auth/callbackcompletes the OAuth callback./api/auth/sign-ininitiates sign-in and supports areturnPathnamequery parameter.<AuthKitProvider>supplies reactive auth state to the header and demo route.
For authorization in loaders and server functions, use getAuth() from
@workos/authkit-tanstack-react-start. Keep WORKOS_API_KEY and
WORKOS_COOKIE_PASSWORD server-only, and replace the local callback and sign-in URLs
with their production equivalents when deploying.