@workos-inc/authkit-remix
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -20,2 +20,3 @@ import { User } from '@workos-inc/node'; | ||
role?: string; | ||
permissions?: string[]; | ||
impersonator?: Impersonator; | ||
@@ -35,2 +36,3 @@ accessToken: string; | ||
role?: string; | ||
permissions?: string[]; | ||
} | ||
@@ -37,0 +39,0 @@ export interface GetAuthURLOptions { |
@@ -75,3 +75,3 @@ "use strict"; | ||
} | ||
const { sid: sessionId, org_id: organizationId, role } = (0, jose_1.decodeJwt)(session.accessToken); | ||
const { sid: sessionId, org_id: organizationId, role, permissions } = (0, jose_1.decodeJwt)(session.accessToken); | ||
return { | ||
@@ -82,2 +82,3 @@ sessionId, | ||
role, | ||
permissions, | ||
impersonator: session.impersonator, | ||
@@ -84,0 +85,0 @@ accessToken: session.accessToken, |
@@ -12,3 +12,3 @@ "use strict"; | ||
name: 'authkit-remix', | ||
version: '0.1.0', | ||
version: '0.2.0', | ||
}, | ||
@@ -15,0 +15,0 @@ }; |
{ | ||
"name": "@workos-inc/authkit-remix", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Authentication and session helpers for using WorkOS & AuthKit with Remix", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
@@ -26,3 +26,3 @@ # AuthKit Remix Library | ||
WORKOS_API_KEY="sk_test_..." # retrieved from the WorkOS dashboard | ||
WORKOS_REDIRECT_URI="http://localhost:3000/callback" # configured in the WorkOS dashboard | ||
WORKOS_REDIRECT_URI="http://localhost:5173/callback" # configured in the WorkOS dashboard | ||
WORKOS_COOKIE_PASSWORD="<your password>" # generate a secure password here | ||
@@ -47,3 +47,3 @@ ``` | ||
WORKOS_API_HTTPS=true # whether to use HTTPS in API calls | ||
WORKOS_API_PORT=3000 # port to use for API calls | ||
WORKOS_API_PORT=5173 # port to use for API calls | ||
``` | ||
@@ -63,3 +63,3 @@ | ||
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`. | ||
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`. | ||
@@ -80,14 +80,8 @@ You can also control the pathname the user will be sent to after signing-in by passing a `returnPathname` option to `authLoader` like so: | ||
import type { ActionFunctionArgs, LoaderFunctionArgs } from '@remix-run/node'; | ||
import { Link, useRouteLoaderData, json, Form } from '@remix-run/react'; | ||
import { Link, useLoaderData, json, Form } from '@remix-run/react'; | ||
import { getSignInUrl, getSignUpUrl, withAuth, signOut } from '@workos-inc/authkit-remix'; | ||
export async function loader({ request }: LoaderFunctionArgs) { | ||
const { | ||
user, | ||
sessionId, | ||
organizationId, | ||
role, | ||
impersonator, | ||
accessToken | ||
} = await withAuth(request); | ||
export async function loader({request}: LoaderFunctionArgs) { | ||
// additional properties include: sessionId, organizationId, role, impersonator, accessToken | ||
const {user} = await withAuth(request); | ||
@@ -113,2 +107,3 @@ return json({ | ||
<Link to={signInUrl}>Log in</Link> | ||
<br /> | ||
<Link to={signUpUrl}>Sign Up</Link> | ||
@@ -115,0 +110,0 @@ </> |
@@ -23,2 +23,3 @@ import { User } from '@workos-inc/node'; | ||
role?: string; | ||
permissions?: string[]; | ||
impersonator?: Impersonator; | ||
@@ -39,2 +40,3 @@ accessToken: string; | ||
role?: string; | ||
permissions?: string[]; | ||
} | ||
@@ -41,0 +43,0 @@ |
@@ -102,3 +102,3 @@ import { redirect } from '@remix-run/node'; | ||
const { sid: sessionId, org_id: organizationId, role } = decodeJwt<AccessToken>(session.accessToken); | ||
const { sid: sessionId, org_id: organizationId, role, permissions } = decodeJwt<AccessToken>(session.accessToken); | ||
@@ -110,2 +110,3 @@ return { | ||
role, | ||
permissions, | ||
impersonator: session.impersonator, | ||
@@ -112,0 +113,0 @@ accessToken: session.accessToken, |
@@ -10,3 +10,3 @@ import { WorkOS } from '@workos-inc/node'; | ||
name: 'authkit-remix', | ||
version: '0.1.0', | ||
version: '0.2.0', | ||
}, | ||
@@ -13,0 +13,0 @@ }; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
47230
763
178
1