examples/react/start-workos/README.md
This site is built with TanStack Router! An example application demonstrating how to authenticate users with AuthKit and the WorkOS Node SDK.
To start a new project based on this example, run:
npx gitpick TanStack/router/tree/main/examples/react/start-workos start-workos
You will need a WorkOS account.
http://localhost:3000/api/auth/callback. Once completed, set the app homepage URL to http://localhost:3000.
[!NOTE] If you already have set up an application in your WorkOS dashboard, then you can simply head to the Redirects tab and add a new redirect URI.
.env.example file to .env and supply your Client ID and API key as environment variables.WORKOS_COOKIE_PASSWORD.
It has to be at least 32 characters long. You can use https://1password.com/password-generator/ to generate strong passwords..env.local file has the following variables filled.
WORKOS_CLIENT_ID=<YOUR_CLIENT_ID>
WORKOS_API_KEY=<YOUR_API_SECRET_KEY>
WORKOS_COOKIE_PASSWORD=<YOUR_COOKIE_PASSWORD>
WORKOS_REDIRECT_URI=http://localhost:3000/callback
WORKOS_COOKIE_PASSWORD is the private key used to encrypt the session cookie. It has to be at least 32 characters long. You can use the 1Password generator or the openssl library to generate a strong password via the command line:
openssl rand -base64 24
signOut method, you'll need to set a default Logout URI in your WorkOS dashboard settings under "Redirects".pnpm dev
Build for production:
pnpm build
This example demonstrates: