Skip to content

Commit edd45f9

Browse files
author
Paul Asjes
authored
Merge pull request #1 from workos/improve-readme-for-copy-paste
Increase copy-paste-ability of README examples
2 parents bee1b90 + a7fff71 commit edd45f9

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

README.md

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Make sure the following values are present in your `.env.local` environment vari
2323
```sh
2424
WORKOS_CLIENT_ID="client_..." # retrieved from the WorkOS dashboard
2525
WORKOS_API_KEY="sk_test_..." # retrieved from the WorkOS dashboard
26-
WORKOS_REDIRECT_URI="http://localhost:3000/callback" # configured in the WorkOS dashboard
26+
WORKOS_REDIRECT_URI="http://localhost:5173/callback" # configured in the WorkOS dashboard
2727
WORKOS_COOKIE_PASSWORD="<your password>" # generate a secure password here
2828
```
2929

@@ -43,7 +43,7 @@ Certain environment variables are optional and can be used to debug or configure
4343
WORKOS_COOKIE_MAX_AGE='600' # maximum age of the cookie in seconds. Defaults to 31 days
4444
WORKOS_API_HOSTNAME='api.workos.com' # base WorkOS API URL
4545
WORKOS_API_HTTPS=true # whether to use HTTPS in API calls
46-
WORKOS_API_PORT=3000 # port to use for API calls
46+
WORKOS_API_PORT=5173 # port to use for API calls
4747
```
4848

4949
## Setup
@@ -58,7 +58,7 @@ import { authLoader } from '@workos-inc/authkit-remix';
5858
export const loader = authLoader();
5959
```
6060

61-
Make sure this route matches the `WORKOS_REDIRECT_URI` variable and the configured redirect URI in your WorkOS dashboard. For instance if your redirect URI is `http://localhost:3000/callback` then you'd put the above code in `/app/routes/callback.ts`.
61+
Make sure this route matches the `WORKOS_REDIRECT_URI` variable and the configured redirect URI in your WorkOS dashboard. For instance if your redirect URI is `http://localhost:5173/callback` then you'd put the above code in `/app/routes/callback.ts`.
6262

6363
You can also control the pathname the user will be sent to after signing-in by passing a `returnPathname` option to `authLoader` like so:
6464

@@ -74,18 +74,12 @@ For pages where you want to display a signed-in and signed-out view, use `withAu
7474

7575
```jsx
7676
import type { ActionFunctionArgs, LoaderFunctionArgs } from '@remix-run/node';
77-
import { Link, useRouteLoaderData, json, Form } from '@remix-run/react';
77+
import { Link, useLoaderData, json, Form } from '@remix-run/react';
7878
import { getSignInUrl, getSignUpUrl, withAuth, signOut } from '@workos-inc/authkit-remix';
7979

80-
export async function loader({ request }: LoaderFunctionArgs) {
81-
const {
82-
user,
83-
sessionId,
84-
organizationId,
85-
role,
86-
impersonator,
87-
accessToken
88-
} = await withAuth(request);
80+
export async function loader({request}: LoaderFunctionArgs) {
81+
// additional properties include: sessionId, organizationId, role, impersonator, accessToken
82+
const {user} = await withAuth(request);
8983

9084
return json({
9185
signInUrl: await getSignInUrl(),
@@ -106,6 +100,7 @@ export default function HomePage() {
106100
return (
107101
<>
108102
<Link to={signInUrl}>Log in</Link>
103+
<br />
109104
<Link to={signUpUrl}>Sign Up</Link>
110105
</>
111106
);

0 commit comments

Comments
 (0)