Skip to content

Commit 2525009

Browse files
committed
rename remix to react router
1 parent 8733353 commit 2525009

File tree

6 files changed

+38
-35
lines changed

6 files changed

+38
-35
lines changed

README.md

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
# AuthKit Remix Library
1+
# AuthKit React Router Library
22

3-
The AuthKit library for Remix provides convenient helpers for authentication and session management using WorkOS & AuthKit with Remix. You can find this library in action in the [remix-authkit-example](https://github.com/workos/remix-authkit-example) repo.
3+
The AuthKit library for React Router 7+ provides convenient helpers for authentication and session management using WorkOS & AuthKit with React Router. You can find this library in action in the [react-rotuer-authkit-example](https://github.com/workos/react-rotuer-authkit-example) repo.
44

55
## Installation
66

77
Install the package with:
88

99
```
10-
npm i @workos-inc/authkit-remix
10+
npm i @workos-inc/authkit-react-router
1111
```
1212

1313
or
1414

1515
```
16-
yarn add @workos-inc/authkit-remix
16+
yarn add @workos-inc/authkit-react-router
1717
```
1818

1919
## Configuration
2020

21-
AuthKit for Remix offers a flexible configuration system that allows you to customize various settings. You can configure the library in three ways:
21+
AuthKit for React Router offers a flexible configuration system that allows you to customize various settings. You can configure the library in three ways:
2222

2323
### 1. Environment Variables
2424

@@ -36,7 +36,7 @@ AuthKit for Remix offers a flexible configuration system that allows you to cust
3636
You can also configure AuthKit programmatically by importing the `configure` function:
3737

3838
```typescript
39-
import { configure } from '@workos-inc/authkit-remix';
39+
import { configure } from '@workos-inc/authkit-react-router';
4040
// In your root or entry file
4141
configure({
4242
clientId: 'client_1234567890',
@@ -59,7 +59,7 @@ For non-standard environments (like Deno or Edge functions), you can provide a c
5959
>While this library includes support for custom environment sources that could theoretically work in non-Node.js runtimes like Deno or Edge functions, this functionality has not been extensively tested (yet). If you're planning to use AuthKit in these environments, you may encounter unexpected issues. We welcome feedback and contributions from users who test in these environments.
6060
6161
```typescript
62-
import { configure } from '@workos-inc/authkit-remix';
62+
import { configure } from '@workos-inc/authkit-react-router';
6363

6464
configure(key => Deno.env.get(key));
6565
// Or combine with explicit values
@@ -103,10 +103,10 @@ When retrieving configuration values, AuthKit follows this priority order:
103103

104104
### Callback route
105105

106-
AuthKit requires that you have a callback URL to redirect users back to after they've authenticated. In your Remix app, [create a new route](https://remix.run/docs/en/main/discussion/routes) and add the following:
106+
AuthKit requires that you have a callback URL to redirect users back to after they've authenticated. In your React Router app, [create a new route](https://reactrouter.com/start/framework/routing) and add the following:
107107

108108
```ts
109-
import { authLoader } from '@workos-inc/authkit-remix';
109+
import { authLoader } from '@workos-inc/authkit-react-router';
110110

111111
export const loader = authLoader();
112112
```
@@ -131,14 +131,13 @@ export const loader = authLoader({
131131

132132
## Usage
133133

134-
### Access authentication data in your Remix application
134+
### Access authentication data in your React Router application
135135

136-
Use `authkitLoader` to configure AuthKit for your Remix application routes.
136+
Use `authkitLoader` to configure AuthKit for your React Router application routes.
137137

138138
```tsx
139-
import type { LoaderFunctionArgs } from '@remix-run/node';
140-
import { useLoaderData } from '@remix-run/react';
141-
import { authkitLoader } from '@workos-inc/authkit-remix';
139+
import { type LoaderFunctionArgs, useLoaderData } from 'react-router';
140+
import { authkitLoader } from '@workos-inc/authkit-react-router';
142141

143142
export const loader = (args: LoaderFunctionArgs) => authkitLoader(args);
144143

@@ -159,14 +158,19 @@ export function App() {
159158
For pages where you want to display a signed-in and signed-out view, use `authkitLoader` to retrieve the user profile from WorkOS. You can pass in additional data by providing a loader function directly to `authkitLoader`.
160159

161160
```tsx
162-
import type { ActionFunctionArgs, LoaderFunctionArgs } from '@remix-run/node';
163-
import { json } from '@remix-run/node';
164-
import { Form, Link, useLoaderData } from '@remix-run/react';
165-
import { getSignInUrl, getSignUpUrl, signOut, authkitLoader } from '@workos-inc/authkit-remix';
161+
import type {
162+
type ActionFunctionArgs,
163+
type LoaderFunctionArgs,
164+
data,
165+
Form,
166+
Link,
167+
useLoaderData
168+
} from 'react-router';
169+
import { getSignInUrl, getSignUpUrl, signOut, authkitLoader } from '@workos-inc/authkit-react-router';
166170

167171
export const loader = (args: LoaderFunctionArgs) =>
168172
authkitLoader(args, async ({ request, auth }) => {
169-
return json({
173+
return data({
170174
signInUrl: await getSignInUrl(),
171175
signUpUrl: await getSignUpUrl(),
172176
});
@@ -217,9 +221,8 @@ Use the `signOut` method to sign out the current logged in user, end the session
217221
Sometimes it is useful to obtain the access token directly, for instance to make API requests to another service.
218222

219223
```tsx
220-
import type { LoaderFunctionArgs } from '@remix-run/node';
221-
import { json } from '@remix-run/node';
222-
import { authkitLoader } from '@workos-inc/authkit-remix';
224+
import { data, type LoaderFunctionArgs } from 'react-router';
225+
import { authkitLoader } from '@workos-inc/authkit-react-router';
223226

224227
export const loader = (args: LoaderFunctionArgs) =>
225228
authkitLoader(args, async ({ auth }) => {
@@ -235,7 +238,7 @@ export const loader = (args: LoaderFunctionArgs) =>
235238
},
236239
});
237240

238-
return json({
241+
return data({
239242
data: serviceData,
240243
});
241244
});
@@ -246,15 +249,15 @@ export const loader = (args: LoaderFunctionArgs) =>
246249
To enable debug logs, pass in the debug flag when using `authkitLoader`.
247250

248251
```ts
249-
import { authkitLoader } from '@workos-inc/authkit-remix';
252+
import { authkitLoader } from '@workos-inc/authkit-react-router';
250253

251254
export const loader = (args: LoaderFunctionArgs) => authkitLoader(args, { debug: true });
252255
```
253256

254257
If providing a loader function, you can pass the options object as the third parameter
255258

256259
```ts
257-
import { authkitLoader } from '@workos-inc/authkit-remix';
260+
import { authkitLoader } from '@workos-inc/authkit-react-router';
258261

259262
export const loader = (args: LoaderFunctionArgs) =>
260263
authkitLoader(

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "@workos-inc/authkit-remix",
2+
"name": "@workos-inc/authkit-react-router",
33
"version": "0.8.0",
4-
"description": "Authentication and session helpers for using WorkOS & AuthKit with Remix",
4+
"description": "Authentication and session helpers for using WorkOS & AuthKit with React Router 7+",
55
"sideEffects": false,
66
"type": "commonjs",
77
"main": "./dist/cjs/index.js",
@@ -51,12 +51,12 @@
5151
"typescript-eslint": "^7.2.0"
5252
},
5353
"license": "MIT",
54-
"homepage": "https://github.com/workos/authkit-remix#readme",
54+
"homepage": "https://github.com/workos/authkit-react-router#readme",
5555
"repository": {
5656
"type": "git",
57-
"url": "git+https://github.com/workos/authkit-remix.git"
57+
"url": "git+https://github.com/workos/authkit-react-router.git"
5858
},
5959
"bugs": {
60-
"url": "https://github.com/workos/authkit-remix/issues"
60+
"url": "https://github.com/workos/authkit-react-router/issues"
6161
}
6262
}

src/session.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ describe('session', () => {
207207
// Execute
208208
const response = await terminateSession(createMockRequest());
209209

210-
// Assert response is instance of Remix Response
210+
// Assert response is instance of Response
211211
expect(response instanceof Response).toBe(true);
212212
expect(response.status).toBe(302);
213213
expect(response.headers.get('Location')).toBe('https://auth.workos.com/logout/test-session-id');

src/workos.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe('workos', () => {
1616
https: true,
1717
port: undefined,
1818
appInfo: {
19-
name: 'authkit-remix',
19+
name: 'authkit-react-router',
2020
version: expect.any(String),
2121
},
2222
} as const;

src/workos.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function createWorkOSInstance() {
2121
https: apiHttps,
2222
port: apiPort,
2323
appInfo: {
24-
name: 'authkit-remix',
24+
name: 'authkit-react-router',
2525
version: VERSION,
2626
},
2727
};

0 commit comments

Comments
 (0)