Skip to content

Commit 609b757

Browse files
committed
update readme start-workos
1 parent 0bacba2 commit 609b757

1 file changed

Lines changed: 26 additions & 11 deletions

File tree

examples/react/start-workos/README.md

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
This site is built with TanStack Router! An example application demonstrating how to authenticate users with AuthKit and the WorkOS Node SDK.
44

55
- [TanStack Router Docs](https://tanstack.com/router)
6+
- [WorkOS Documentation](https://workos.com/docs)
7+
8+
## Start a new project based on this example
9+
10+
To start a new project based on this example, run:
11+
12+
```sh
13+
npx gitpick TanStack/router/tree/main/examples/react/start-workos start-workos
14+
```
615

716
## Prerequisites
817

@@ -11,35 +20,41 @@ You will need a [WorkOS account](https://dashboard.workos.com/signup).
1120
## Running the example
1221

1322
1. In the [WorkOS dashboard](https://dashboard.workos.com), click on the User Management tile and set up the [sign-in callback redirect](https://workos.com/docs/user-management/1-configure-your-project/configure-a-redirect-uri) as `http://localhost:3000/api/auth/callback`. Once completed, set the app homepage URL to `http://localhost:3000`.
14-
1523
> [!NOTE]
1624
> 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.
17-
1825
2. After creating the redirect URI, navigate to the API keys tab and copy the _Client ID_ and the _Secret Key_. Rename the `.env.example` file to `.env` and supply your Client ID and API key as environment variables.
19-
2026
3. Additionally, create a cookie password as the private key used to encrypt the session cookie. Copy the output into the environment variable `WORKOS_COOKIE_PASSWORD`.
21-
2227
It has to be at least 32 characters long. You can use https://1password.com/password-generator/ to generate strong passwords.
23-
2428
4. Verify your `.env.local` file has the following variables filled.
25-
2629
```bash
2730
WORKOS_CLIENT_ID=<YOUR_CLIENT_ID>
2831
WORKOS_API_KEY=<YOUR_API_SECRET_KEY>
2932
WORKOS_COOKIE_PASSWORD=<YOUR_COOKIE_PASSWORD>
3033
WORKOS_REDIRECT_URI=http://localhost:3000/callback
3134
```
32-
3335
`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](https://1password.com/password-generator/) or the `openssl` library to generate a strong password via the command line:
34-
3536
```bash
3637
openssl rand -base64 24
3738
```
38-
3939
To use the `signOut` method, you'll need to set a default Logout URI in your WorkOS dashboard settings under "Redirects".
40-
4140
5. Run the following command and navigate to [http://localhost:3000](http://localhost:3000).
42-
4341
```bash
4442
pnpm dev
4543
```
44+
45+
## Build
46+
47+
Build for production:
48+
49+
```sh
50+
pnpm build
51+
```
52+
53+
## About This Example
54+
55+
This example demonstrates:
56+
57+
- WorkOS authentication integration
58+
- AuthKit usage
59+
- Protected routes
60+
- User session management

0 commit comments

Comments
 (0)