@workos-inc/authkit-nextjs 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +145 -0
  3. package/dist/cjs/auth.d.ts +3 -0
  4. package/dist/cjs/auth.js +17 -0
  5. package/dist/cjs/auth.js.map +1 -0
  6. package/dist/cjs/authkit-callback-route.d.ts +3 -0
  7. package/dist/cjs/authkit-callback-route.js +58 -0
  8. package/dist/cjs/authkit-callback-route.js.map +1 -0
  9. package/dist/cjs/button.d.ts +3 -0
  10. package/dist/cjs/button.js +25 -0
  11. package/dist/cjs/button.js.map +1 -0
  12. package/dist/cjs/cookie.d.ts +8 -0
  13. package/dist/cjs/cookie.js +13 -0
  14. package/dist/cjs/cookie.js.map +1 -0
  15. package/dist/cjs/env-variables.d.ts +5 -0
  16. package/dist/cjs/env-variables.js +22 -0
  17. package/dist/cjs/env-variables.js.map +1 -0
  18. package/dist/cjs/get-authorization-url.d.ts +2 -0
  19. package/dist/cjs/get-authorization-url.js +15 -0
  20. package/dist/cjs/get-authorization-url.js.map +1 -0
  21. package/dist/cjs/impersonation.d.ts +6 -0
  22. package/dist/cjs/impersonation.js +119 -0
  23. package/dist/cjs/impersonation.js.map +1 -0
  24. package/dist/cjs/index.d.ts +6 -0
  25. package/dist/cjs/index.js +15 -0
  26. package/dist/cjs/index.js.map +1 -0
  27. package/dist/cjs/interfaces.d.ts +33 -0
  28. package/dist/cjs/interfaces.js +3 -0
  29. package/dist/cjs/interfaces.js.map +1 -0
  30. package/dist/cjs/middleware.d.ts +6 -0
  31. package/dist/cjs/middleware.js +11 -0
  32. package/dist/cjs/middleware.js.map +1 -0
  33. package/dist/cjs/min-max-button.d.ts +7 -0
  34. package/dist/cjs/min-max-button.js +15 -0
  35. package/dist/cjs/min-max-button.js.map +1 -0
  36. package/dist/cjs/session.d.ts +12 -0
  37. package/dist/cjs/session.js +123 -0
  38. package/dist/cjs/session.js.map +1 -0
  39. package/dist/cjs/workos.d.ts +3 -0
  40. package/dist/cjs/workos.js +10 -0
  41. package/dist/cjs/workos.js.map +1 -0
  42. package/package.json +55 -0
  43. package/src/auth.ts +15 -0
  44. package/src/authkit-callback-route.ts +69 -0
  45. package/src/button.tsx +32 -0
  46. package/src/cookie.ts +9 -0
  47. package/src/env-variables.ts +18 -0
  48. package/src/get-authorization-url.ts +13 -0
  49. package/src/impersonation.tsx +157 -0
  50. package/src/index.ts +17 -0
  51. package/src/interfaces.ts +37 -0
  52. package/src/middleware.ts +12 -0
  53. package/src/min-max-button.tsx +23 -0
  54. package/src/session.ts +137 -0
  55. package/src/workos.ts +7 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 WorkOS
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,145 @@
1
+ # AuthKit Next.js Library
2
+
3
+ The AuthKit library for Next.js provides convenient helpers for authentication and session management using WorkOS & AuthKit with Next.js.
4
+
5
+ ## Installation
6
+
7
+ Install the package with:
8
+
9
+ ```
10
+ npm i @workos-inc/authkit-nextjs
11
+ ```
12
+
13
+ or
14
+
15
+ ```
16
+ yarn add @workos-inc/authkit-nextjs
17
+ ```
18
+
19
+ ## Pre-flight
20
+
21
+ Make sure the following values are present in your `.env.local` environment variables file. The client ID and API key can be found in the [WorkOS dashboard](https://dashboard.workos.com), and the redirect URI can also be configured there.
22
+
23
+ ```sh
24
+ WORKOS_CLIENT_ID="client_..." # retrieved from the WorkOS dashboard
25
+ WORKOS_API_KEY="sk_test_..." # retrieved from the WorkOS dashboard
26
+ WORKOS_REDIRECT_URI="http://localhost:3000/callback" # configured in the WorkOS dashboard
27
+ WORKOS_COOKIE_PASSWORD="<your password>" # generate a secure password here
28
+ ```
29
+
30
+ `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:
31
+
32
+ ```
33
+ openssl rand -base64 24
34
+ ```
35
+
36
+ To use the `signOut` method, you'll need to set your app's homepage in your WorkOS dashboard settings under "Redirects".
37
+
38
+ ## Setup
39
+
40
+ ### Callback route
41
+
42
+ WorkOS requires that you have a callback URL to redirect users back to after they've authenticated. In your Next.js app, [expose an API route](https://nextjs.org/docs/app/building-your-application/routing/route-handlers) and add the following.
43
+
44
+ ```ts
45
+ import { handleAuth } from '@workos-inc/authkit-nextjs';
46
+
47
+ export const GET = handleAuth();
48
+ ```
49
+
50
+ 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/auth/callback` then you'd put the above code in `/app/auth/callback/route.ts`.
51
+
52
+ You can also control the pathname the user will be sent to after signing-in by passing a `returnPathname` option to `handleAuth` like so:
53
+
54
+ ```ts
55
+ export const GET = handleAuth({ returnPathname: '/dashboard' });
56
+ ```
57
+
58
+ ### Middleware
59
+
60
+ This library relies on [Next.js middleware](https://nextjs.org/docs/app/building-your-application/routing/middleware) to provide session management for routes. Put the following in your `middleware.ts` file in the root of your project:
61
+
62
+ ```ts
63
+ import { authkitMiddleware } from '@workos-inc/authkit-nextjs';
64
+
65
+ export default authkitMiddleware();
66
+
67
+ // Match against pages that require auth
68
+ // Leave this out if you want auth on every page in your application
69
+ export const config = { matcher: ['/admin'] };
70
+ ```
71
+
72
+ ## Usage
73
+
74
+ ### Get the current user
75
+
76
+ For pages where you want to display a signed-in and signed-out view, use `getUser` to retrieve the user profile from WorkOS.
77
+
78
+ ```jsx
79
+ import Link from 'next/link';
80
+ import { getSignInUrl, getUser, signOut } from '@workos-inc/authkit-nextjs';
81
+
82
+ export default async function HomePage() {
83
+ // Retrieves the user from the session or returns `null` if no user is signed in
84
+ const { user } = await getUser();
85
+
86
+ // Get the URL to redirect the user to AuthKit to sign in
87
+ const signInUrl = await getSignInUrl();
88
+
89
+ return user ? (
90
+ <form
91
+ action={async () => {
92
+ 'use server';
93
+ await signOut();
94
+ }}
95
+ >
96
+ <p>Welcome back {user?.firstName && `, ${user?.firstName}`}</p>
97
+ <button type="submit">Sign out</button>
98
+ </form>
99
+ ) : (
100
+ <Link href={signInUrl}>Sign in</Link>
101
+ );
102
+ }
103
+ ```
104
+
105
+ ### Requiring auth
106
+
107
+ For pages where a signed-in user is mandatory, you can use the `ensureSignedIn` option:
108
+
109
+ ```jsx
110
+ const { user } = await getUser({ ensureSignedIn: true });
111
+ ```
112
+
113
+ Enabling `ensureSignedIn` will redirect users to AuthKit if they attempt to access the page without being authenticated.
114
+
115
+ ### Signing out
116
+
117
+ Use the `signOut` method to sign out the current logged in user and redirect to your app's homepage. The homepage redirect is set in your WorkOS dashboard settings under "Redirect".
118
+
119
+ ### Visualizing an impersonation
120
+
121
+ Render the `Impersonation` component in your app so that it is clear when someone is [impersonating a user](https://workos.com/docs/user-management/impersonation).
122
+ The component will display a frame with some information about the impersonated user, as well as a button to stop impersonating.
123
+
124
+ ```jsx
125
+ import { Impersonation } from '@workos-inc/authkit-nextjs';
126
+
127
+ export default function App() {
128
+ return (
129
+ <div>
130
+ <Impersonation />
131
+ {/* Your app content */}
132
+ </div>
133
+ );
134
+ }
135
+ ```
136
+
137
+ ### Debugging
138
+
139
+ To enable debug logs, initialize the middleware with the debug flag enabled.
140
+
141
+ ```js
142
+ import { authkitMiddleware } from '@workos-inc/authkit-nextjs';
143
+
144
+ export default authkitMiddleware({ debug: true });
145
+ ```
@@ -0,0 +1,3 @@
1
+ declare function getSignInUrl(): Promise<string>;
2
+ declare function signOut(): Promise<void>;
3
+ export { getSignInUrl, signOut };
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.signOut = exports.getSignInUrl = void 0;
4
+ const get_authorization_url_js_1 = require("./get-authorization-url.js");
5
+ const headers_1 = require("next/headers");
6
+ const cookie_js_1 = require("./cookie.js");
7
+ const session_js_1 = require("./session.js");
8
+ async function getSignInUrl() {
9
+ return (0, get_authorization_url_js_1.getAuthorizationUrl)();
10
+ }
11
+ exports.getSignInUrl = getSignInUrl;
12
+ async function signOut() {
13
+ (0, headers_1.cookies)().delete(cookie_js_1.cookieName);
14
+ await (0, session_js_1.terminateSession)();
15
+ }
16
+ exports.signOut = signOut;
17
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/auth.ts"],"names":[],"mappings":";;;AAAA,yEAAiE;AACjE,0CAAuC;AACvC,2CAAyC;AACzC,6CAAgD;AAEhD,KAAK,UAAU,YAAY;IACzB,OAAO,IAAA,8CAAmB,GAAE,CAAC;AAC/B,CAAC;AAOQ,oCAAY;AALrB,KAAK,UAAU,OAAO;IACpB,IAAA,iBAAO,GAAE,CAAC,MAAM,CAAC,sBAAU,CAAC,CAAC;IAC7B,MAAM,IAAA,6BAAgB,GAAE,CAAC;AAC3B,CAAC;AAEsB,0BAAO"}
@@ -0,0 +1,3 @@
1
+ import { NextRequest, NextResponse } from 'next/server';
2
+ import { HandleAuthOptions } from './interfaces.js';
3
+ export declare function handleAuth(options?: HandleAuthOptions): (request: NextRequest) => Promise<NextResponse<unknown>>;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handleAuth = void 0;
4
+ const server_1 = require("next/server");
5
+ const headers_1 = require("next/headers");
6
+ const workos_js_1 = require("./workos.js");
7
+ const env_variables_js_1 = require("./env-variables.js");
8
+ const session_js_1 = require("./session.js");
9
+ const cookie_js_1 = require("./cookie.js");
10
+ function handleAuth(options = {}) {
11
+ const { returnPathname: returnPathnameOption = '/' } = options;
12
+ return async function GET(request) {
13
+ const code = request.nextUrl.searchParams.get('code');
14
+ const state = request.nextUrl.searchParams.get('state');
15
+ const returnPathname = state ? JSON.parse(atob(state)).returnPathname : null;
16
+ if (code) {
17
+ try {
18
+ // Use the code returned to us by AuthKit and authenticate the user with WorkOS
19
+ const { accessToken, refreshToken, user, impersonator } = await workos_js_1.workos.userManagement.authenticateWithCode({
20
+ clientId: env_variables_js_1.WORKOS_CLIENT_ID,
21
+ code,
22
+ });
23
+ const url = request.nextUrl.clone();
24
+ // Cleanup params
25
+ url.searchParams.delete('code');
26
+ url.searchParams.delete('state');
27
+ // Redirect to the requested path and store the session
28
+ url.pathname = returnPathname !== null && returnPathname !== void 0 ? returnPathname : returnPathnameOption;
29
+ const response = server_1.NextResponse.redirect(url);
30
+ if (!accessToken || !refreshToken)
31
+ throw new Error('response is missing tokens');
32
+ // The refreshToken should never be accesible publicly, hence why we encrypt it in the cookie session
33
+ // Alternatively you could persist the refresh token in a backend database
34
+ const session = await (0, session_js_1.encryptSession)({ accessToken, refreshToken, user, impersonator });
35
+ (0, headers_1.cookies)().set(cookie_js_1.cookieName, session, cookie_js_1.cookieOptions);
36
+ return response;
37
+ }
38
+ catch (error) {
39
+ const errorRes = {
40
+ error: error instanceof Error ? error.message : String(error),
41
+ };
42
+ console.error(errorRes);
43
+ return errorResponse();
44
+ }
45
+ }
46
+ return errorResponse();
47
+ };
48
+ function errorResponse() {
49
+ return server_1.NextResponse.json({
50
+ error: {
51
+ message: 'Something went wrong',
52
+ description: 'Couldn’t sign in. If you are not sure what happened, please contact your organization admin.',
53
+ },
54
+ }, { status: 500 });
55
+ }
56
+ }
57
+ exports.handleAuth = handleAuth;
58
+ //# sourceMappingURL=authkit-callback-route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authkit-callback-route.js","sourceRoot":"","sources":["../../src/authkit-callback-route.ts"],"names":[],"mappings":";;;AAAA,wCAAwD;AACxD,0CAAuC;AACvC,2CAAqC;AACrC,yDAAsD;AACtD,6CAA8C;AAC9C,2CAAwD;AAGxD,SAAgB,UAAU,CAAC,UAA6B,EAAE;IACxD,MAAM,EAAE,cAAc,EAAE,oBAAoB,GAAG,GAAG,EAAE,GAAG,OAAO,CAAC;IAE/D,OAAO,KAAK,UAAU,GAAG,CAAC,OAAoB;QAC5C,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACtD,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACxD,MAAM,cAAc,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC;QAE7E,IAAI,IAAI,EAAE,CAAC;YACT,IAAI,CAAC;gBACH,+EAA+E;gBAC/E,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,MAAM,kBAAM,CAAC,cAAc,CAAC,oBAAoB,CAAC;oBACzG,QAAQ,EAAE,mCAAgB;oBAC1B,IAAI;iBACL,C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G;SACF,EACD,EAAE,MAAM,EAAE,GAAG,EAAE,CAChB,CAAC;IACJ,CAAC;AACH,CAAC;AA5DD,gCA4DC"}
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ declare const Button: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
3
+ export { Button };
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Button = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const React = tslib_1.__importStar(require("react"));
6
+ const Button = React.forwardRef((props, forwardedRef) => {
7
+ return (React.createElement("button", { ref: forwardedRef, type: "button", ...props, style: {
8
+ display: 'inline-flex',
9
+ alignItems: 'center',
10
+ justifyContent: 'center',
11
+ flexShrink: 0,
12
+ height: '1.714em',
13
+ padding: '0 0.6em',
14
+ fontFamily: 'inherit',
15
+ fontSize: 'inherit',
16
+ borderRadius: 'min(max(calc(var(--wi-s) * 0.6), 1px), 7px)',
17
+ border: 'none',
18
+ backgroundColor: 'var(--wi-c)',
19
+ color: 'white',
20
+ ...props.style,
21
+ } }));
22
+ });
23
+ exports.Button = Button;
24
+ Button.displayName = 'Button';
25
+ //# sourceMappingURL=button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/button.tsx"],"names":[],"mappings":";;;;AAAA,qDAA+B;AAE/B,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAA8D,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE;IACnH,OAAO,CACL,gCACE,GAAG,EAAE,YAAY,EACjB,IAAI,EAAC,QAAQ,KACT,KAAK,EACT,KAAK,EAAE;YACL,OAAO,EAAE,aAAa;YACtB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,QAAQ;YACxB,UAAU,EAAE,CAAC;YACb,MAAM,EAAE,SAAS;YACjB,OAAO,EAAE,SAAS;YAElB,UAAU,EAAE,SAAS;YACrB,QAAQ,EAAE,SAAS;YACnB,YAAY,EAAE,6CAA6C;YAC3D,MAAM,EAAE,MAAM;YACd,eAAe,EAAE,aAAa;YAC9B,KAAK,EAAE,OAAO;YAEd,GAAG,KAAK,CAAC,KAAK;SACf,GACD,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAIM,wBAAM;AAFf,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC"}
@@ -0,0 +1,8 @@
1
+ declare const cookieName = "wos-session";
2
+ declare const cookieOptions: {
3
+ path: string;
4
+ httpOnly: boolean;
5
+ secure: boolean;
6
+ sameSite: "lax";
7
+ };
8
+ export { cookieName, cookieOptions };
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cookieOptions = exports.cookieName = void 0;
4
+ const cookieName = 'wos-session';
5
+ exports.cookieName = cookieName;
6
+ const cookieOptions = {
7
+ path: '/',
8
+ httpOnly: true,
9
+ secure: true,
10
+ sameSite: 'lax',
11
+ };
12
+ exports.cookieOptions = cookieOptions;
13
+ //# sourceMappingURL=cookie.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cookie.js","sourceRoot":"","sources":["../../src/cookie.ts"],"names":[],"mappings":";;;AAAA,MAAM,UAAU,GAAG,aAAa,CAAC;AAQxB,gCAAU;AAPnB,MAAM,aAAa,GAAG;IACpB,IAAI,EAAE,GAAG;IACT,QAAQ,EAAE,IAAI;IACd,MAAM,EAAE,IAAI;IACZ,QAAQ,EAAE,KAAc;CACzB,CAAC;AAEmB,sCAAa"}
@@ -0,0 +1,5 @@
1
+ declare const WORKOS_CLIENT_ID: string;
2
+ declare const WORKOS_API_KEY: string;
3
+ declare const WORKOS_REDIRECT_URI: string;
4
+ declare const WORKOS_COOKIE_PASSWORD: string;
5
+ export { WORKOS_CLIENT_ID, WORKOS_API_KEY, WORKOS_REDIRECT_URI, WORKOS_COOKIE_PASSWORD };
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WORKOS_COOKIE_PASSWORD = exports.WORKOS_REDIRECT_URI = exports.WORKOS_API_KEY = exports.WORKOS_CLIENT_ID = void 0;
4
+ function getEnvVariable(name) {
5
+ const envVariable = process.env[name];
6
+ if (!envVariable) {
7
+ throw new Error(`${name} environment variable is not set`);
8
+ }
9
+ return envVariable;
10
+ }
11
+ const WORKOS_CLIENT_ID = getEnvVariable('WORKOS_CLIENT_ID');
12
+ exports.WORKOS_CLIENT_ID = WORKOS_CLIENT_ID;
13
+ const WORKOS_API_KEY = getEnvVariable('WORKOS_API_KEY');
14
+ exports.WORKOS_API_KEY = WORKOS_API_KEY;
15
+ const WORKOS_REDIRECT_URI = getEnvVariable('WORKOS_REDIRECT_URI');
16
+ exports.WORKOS_REDIRECT_URI = WORKOS_REDIRECT_URI;
17
+ const WORKOS_COOKIE_PASSWORD = getEnvVariable('WORKOS_COOKIE_PASSWORD');
18
+ exports.WORKOS_COOKIE_PASSWORD = WORKOS_COOKIE_PASSWORD;
19
+ if (WORKOS_COOKIE_PASSWORD.length < 32) {
20
+ throw new Error('WORKOS_COOKIE_PASSWORD must be at least 32 characters long');
21
+ }
22
+ //# sourceMappingURL=env-variables.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env-variables.js","sourceRoot":"","sources":["../../src/env-variables.ts"],"names":[],"mappings":";;;AAAA,SAAS,cAAc,CAAC,IAAY;IAClC,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACtC,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,kCAAkC,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,MAAM,gBAAgB,GAAG,cAAc,CAAC,kBAAkB,CAAC,CAAC;AASnD,4CAAgB;AARzB,MAAM,cAAc,GAAG,cAAc,CAAC,gBAAgB,CAAC,CAAC;AAQ7B,wCAAc;AAPzC,MAAM,mBAAmB,GAAG,cAAc,CAAC,qBAAqB,CAAC,CAAC;AAOvB,kDAAmB;AAN9D,MAAM,sBAAsB,GAAG,cAAc,CAAC,wBAAwB,CAAC,CAAC;AAMR,wDAAsB;AAJtF,IAAI,sBAAsB,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;IACvC,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;AAChF,CAAC"}
@@ -0,0 +1,2 @@
1
+ declare function getAuthorizationUrl(returnPathname?: string): Promise<string>;
2
+ export { getAuthorizationUrl };
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAuthorizationUrl = void 0;
4
+ const workos_js_1 = require("./workos.js");
5
+ const env_variables_js_1 = require("./env-variables.js");
6
+ async function getAuthorizationUrl(returnPathname) {
7
+ return workos_js_1.workos.userManagement.getAuthorizationUrl({
8
+ provider: 'authkit',
9
+ clientId: env_variables_js_1.WORKOS_CLIENT_ID,
10
+ redirectUri: env_variables_js_1.WORKOS_REDIRECT_URI,
11
+ state: returnPathname ? btoa(JSON.stringify({ returnPathname })) : undefined,
12
+ });
13
+ }
14
+ exports.getAuthorizationUrl = getAuthorizationUrl;
15
+ //# sourceMappingURL=get-authorization-url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-authorization-url.js","sourceRoot":"","sources":["../../src/get-authorization-url.ts"],"names":[],"mappings":";;;AAAA,2CAAqC;AACrC,yDAA2E;AAE3E,KAAK,UAAU,mBAAmB,CAAC,cAAuB;IACxD,OAAO,kBAAM,CAAC,cAAc,CAAC,mBAAmB,CAAC;QAC/C,QAAQ,EAAE,SAAS;QACnB,QAAQ,EAAE,mCAAgB;QAC1B,WAAW,EAAE,sCAAmB;QAChC,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS;KAC7E,CAAC,CAAC;AACL,CAAC;AAEQ,kDAAmB"}
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ interface ImpersonationProps extends React.ComponentPropsWithoutRef<'div'> {
3
+ side?: 'top' | 'bottom';
4
+ }
5
+ export declare function Impersonation({ side, ...props }: ImpersonationProps): Promise<React.JSX.Element | null>;
6
+ export {};
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Impersonation = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const React = tslib_1.__importStar(require("react"));
6
+ const session_js_1 = require("./session.js");
7
+ const auth_js_1 = require("./auth.js");
8
+ const workos_js_1 = require("./workos.js");
9
+ const button_js_1 = require("./button.js");
10
+ const min_max_button_js_1 = require("./min-max-button.js");
11
+ async function Impersonation({ side = 'bottom', ...props }) {
12
+ const { impersonator, user, organizationId } = await (0, session_js_1.getUser)();
13
+ if (!impersonator)
14
+ return null;
15
+ const organization = organizationId ? await workos_js_1.workos.organizations.getOrganization(organizationId) : null;
16
+ return (React.createElement("div", { ...props, "data-workos-impersonation-root": "", style: {
17
+ 'position': 'fixed',
18
+ 'inset': 0,
19
+ 'pointerEvents': 'none',
20
+ 'zIndex': 9999,
21
+ // short properties with defaults for authoring convenience
22
+ '--wi-minimized': '0',
23
+ '--wi-s': 'min(max(var(--workos-impersonation-size, 4px), 2px), 15px)',
24
+ '--wi-bgc': 'var(--workos-impersonation-background-color, #fce654)',
25
+ '--wi-c': 'var(--workos-impersonation-color, #1a1600)',
26
+ '--wi-bc': 'var(--workos-impersonation-border-color, #e0c36c)',
27
+ '--wi-bw': 'var(--workos-impersonation-border-width, 1px)',
28
+ ...props.style,
29
+ } },
30
+ React.createElement("div", { style: {
31
+ '--wi-frame-size': 'calc(var(--wi-s) * (1 - var(--wi-minimized)) + var(--wi-minimized) * var(--wi-bw) * -1)',
32
+ 'position': 'absolute',
33
+ 'inset': 'calc(var(--wi-frame-size) * -1)',
34
+ 'borderRadius': 'calc(var(--wi-frame-size) * 3)',
35
+ 'boxShadow': `
36
+ inset 0 0 0 calc(var(--wi-frame-size) * 2) var(--wi-bgc),
37
+ inset 0 0 0 calc(var(--wi-frame-size) * 2 + var(--wi-bw)) var(--wi-bc)
38
+ `,
39
+ 'transition': 'all 500ms cubic-bezier(0.16, 1, 0.3, 1)',
40
+ } }),
41
+ React.createElement("div", { style: {
42
+ display: 'flex',
43
+ justifyContent: 'center',
44
+ position: 'fixed',
45
+ left: 0,
46
+ right: 0,
47
+ ...(side === 'top' && { top: 'var(--wi-s)' }),
48
+ ...(side === 'bottom' && { bottom: 'var(--wi-s)' }),
49
+ fontFamily: "system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif",
50
+ fontSize: 'calc(12px + var(--wi-s) * 0.5)',
51
+ lineHeight: '1.4',
52
+ } },
53
+ React.createElement("form", { action: async () => {
54
+ 'use server';
55
+ await (0, auth_js_1.signOut)();
56
+ }, style: {
57
+ display: 'flex',
58
+ alignItems: 'baseline',
59
+ paddingLeft: 'var(--wi-s)',
60
+ paddingRight: 'var(--wi-s)',
61
+ position: 'relative',
62
+ marginLeft: 'calc(var(--wi-s) * 2)',
63
+ marginRight: 'calc(var(--wi-s) * 2)',
64
+ pointerEvents: 'auto',
65
+ backgroundColor: 'var(--wi-bgc)',
66
+ borderStyle: 'solid',
67
+ borderColor: 'var(--wi-bc)',
68
+ borderLeftWidth: 'var(--wi-bw)',
69
+ borderRightWidth: 'var(--wi-bw)',
70
+ transition: 'all 500ms cubic-bezier(0.16, 1, 0.3, 1)',
71
+ transform: `translateX(calc(var(--wi-minimized) * (var(--wi-s) * 10 - 5%)))`,
72
+ opacity: 'calc(1 - var(--wi-minimized))',
73
+ zIndex: 'calc(1 - var(--wi-minimized))',
74
+ ...(side === 'top' && {
75
+ paddingTop: 0,
76
+ paddingBottom: 'var(--wi-s)',
77
+ borderTopWidth: 0,
78
+ borderBottomWidth: 'var(--wi-bw)',
79
+ borderBottomLeftRadius: 'var(--wi-s)',
80
+ borderBottomRightRadius: 'var(--wi-s)',
81
+ }),
82
+ ...(side === 'bottom' && {
83
+ paddingTop: 'var(--wi-s)',
84
+ paddingBottom: 0,
85
+ borderTopWidth: 'var(--wi-bw)',
86
+ borderBottomWidth: 0,
87
+ borderTopLeftRadius: 'var(--wi-s)',
88
+ borderTopRightRadius: 'var(--wi-s)',
89
+ }),
90
+ } },
91
+ React.createElement("p", { style: { all: 'unset', color: 'var(--wi-c)', textWrap: 'balance', marginLeft: 'var(--wi-s)' } },
92
+ "You are impersonating ",
93
+ React.createElement("b", null, user.email),
94
+ ' ',
95
+ organization !== null && (React.createElement(React.Fragment, null,
96
+ "within the ",
97
+ React.createElement("b", null, organization.name),
98
+ " organization"))),
99
+ React.createElement(button_js_1.Button, { type: "submit", style: { marginLeft: 'calc(var(--wi-s) * 2)', marginRight: 'var(--wi-s)' } }, "Stop"),
100
+ React.createElement(min_max_button_js_1.MinMaxButton, { minimizedValue: "1" }, side === 'top' ? '↗' : '↘')),
101
+ React.createElement("div", { style: {
102
+ padding: 'var(--wi-s)',
103
+ position: 'fixed',
104
+ right: 'var(--wi-s)',
105
+ pointerEvents: 'auto',
106
+ backgroundColor: 'var(--wi-bgc)',
107
+ border: 'var(--wi-bw) solid var(--wi-bc)',
108
+ borderRadius: 'var(--wi-s)',
109
+ transition: 'all 500ms cubic-bezier(0.16, 1, 0.3, 1)',
110
+ transform: 'translateX(calc((1 - var(--wi-minimized)) * var(--wi-s) * -5))',
111
+ opacity: 'var(--wi-minimized)',
112
+ zIndex: 'var(--wi-minimized)',
113
+ ...(side === 'top' && { top: 'var(--wi-s)' }),
114
+ ...(side === 'bottom' && { bottom: 'var(--wi-s)' }),
115
+ } },
116
+ React.createElement(min_max_button_js_1.MinMaxButton, { minimizedValue: "0" }, side === 'top' ? '↙' : '↖')))));
117
+ }
118
+ exports.Impersonation = Impersonation;
119
+ //# sourceMappingURL=impersonation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"impersonation.js","sourceRoot":"","sources":["../../src/impersonation.tsx"],"names":[],"mappings":";;;;AAAA,qDAA+B;AAC/B,6CAAuC;AACvC,uCAAoC;AACpC,2CAAqC;AACrC,2CAAqC;AACrC,2DAAmD;AAM5C,KAAK,UAAU,aAAa,CAAC,EAAE,IAAI,GAAG,QAAQ,EAAE,GAAG,KAAK,EAAsB;IACnF,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,MAAM,IAAA,oBAAO,GAAE,CAAC;IAE/D,IAAI,CAAC,YAAY;QAAE,OAAO,IAAI,CAAC;IAE/B,MAAM,YAAY,GAAG,cAAc,CAAC,CAAC,CAAC,MAAM,kBAAM,CAAC,aAAa,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAExG,OAAO,CACL,gCACM,KAAK,oCACsB,EAAE,EACjC,KAAK,EAAE;YACL,UAAU,EAAE,OAAO;YACnB,OAAO,EAAE,CAAC;YACV,eAAe,EAAE,MAAM;YACvB,QAAQ,EAAE,IAAI;YAEd,2DAA2D;YAC3D,gBAAgB,EAAE,GAAG;YACrB,QAAQ,EAAE,4DAA4D;YACtE,UAAU,EAAE,uDAAuD;YACnE,QAAQ,EAAE,4CAA4C;YACtD,SAAS,EAAE,mDAAmD;YAC9D,SAAS,EAAE,+CAA+C;YAE1D,GAAG,KAAK,CAAC,KAAK;SACf;QAED,6BACE,KAAK,EAAE;gBACL,iBAAiB,EAAE,yFAAyF;gBAC5G,UAAU,EAAE,UAAU;gBACtB,OAAO,EAAE,iCAAiC;gBAC1C,cAAc,EAAE,gCAAgC;gBAChD,WAAW,EAAE;;;MAGjB;gBACI,YAAY,EAAE,yCAAyC;aACxD,GACD;QAEF,6BACE,KAAK,EAAE;gB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IAAE,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAgB,CACxE,CACF,CACF,CACP,CAAC;AACJ,CAAC;AAjJD,sCAiJC"}
@@ -0,0 +1,6 @@
1
+ import { handleAuth } from './authkit-callback-route.js';
2
+ import { authkitMiddleware } from './middleware.js';
3
+ import { getUser } from './session.js';
4
+ import { getSignInUrl, signOut } from './auth.js';
5
+ import { Impersonation } from './impersonation.js';
6
+ export { handleAuth, authkitMiddleware, getSignInUrl, getUser, signOut, Impersonation, };
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Impersonation = exports.signOut = exports.getUser = exports.getSignInUrl = exports.authkitMiddleware = exports.handleAuth = void 0;
4
+ const authkit_callback_route_js_1 = require("./authkit-callback-route.js");
5
+ Object.defineProperty(exports, "handleAuth", { enumerable: true, get: function () { return authkit_callback_route_js_1.handleAuth; } });
6
+ const middleware_js_1 = require("./middleware.js");
7
+ Object.defineProperty(exports, "authkitMiddleware", { enumerable: true, get: function () { return middleware_js_1.authkitMiddleware; } });
8
+ const session_js_1 = require("./session.js");
9
+ Object.defineProperty(exports, "getUser", { enumerable: true, get: function () { return session_js_1.getUser; } });
10
+ const auth_js_1 = require("./auth.js");
11
+ Object.defineProperty(exports, "getSignInUrl", { enumerable: true, get: function () { return auth_js_1.getSignInUrl; } });
12
+ Object.defineProperty(exports, "signOut", { enumerable: true, get: function () { return auth_js_1.signOut; } });
13
+ const impersonation_js_1 = require("./impersonation.js");
14
+ Object.defineProperty(exports, "Impersonation", { enumerable: true, get: function () { return impersonation_js_1.Impersonation; } });
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,2EAAyD;AAOvD,2FAPO,sCAAU,OAOP;AANZ,mDAAoD;AAQlD,kGARO,iCAAiB,OAQP;AAPnB,6CAAuC;AAUrC,wFAVO,oBAAO,OAUP;AATT,uCAAkD;AAQhD,6FARO,sBAAY,OAQP;AAEZ,wFAVqB,iBAAO,OAUrB;AATT,yDAAmD;AAWjD,8FAXO,gCAAa,OAWP"}
@@ -0,0 +1,33 @@
1
+ import { User } from '@workos-inc/node';
2
+ export interface HandleAuthOptions {
3
+ returnPathname?: string;
4
+ }
5
+ export interface Impersonator {
6
+ email: string;
7
+ reason: string | null;
8
+ }
9
+ export interface Session {
10
+ accessToken: string;
11
+ refreshToken: string;
12
+ user: User;
13
+ impersonator?: Impersonator;
14
+ }
15
+ export interface UserInfo {
16
+ user: User;
17
+ sessionId: string;
18
+ organizationId?: string;
19
+ role?: string;
20
+ impersonator?: Impersonator;
21
+ }
22
+ export interface NoUserInfo {
23
+ user: null;
24
+ sessionId?: undefined;
25
+ organizationId?: undefined;
26
+ role?: undefined;
27
+ impersonator?: undefined;
28
+ }
29
+ export interface AccessToken {
30
+ sid: string;
31
+ org_id?: string;
32
+ role?: string;
33
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=interfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/interfaces.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import { NextMiddleware } from 'next/server';
2
+ interface AuthkitMiddlewareOptions {
3
+ debug?: boolean;
4
+ }
5
+ export declare function authkitMiddleware({ debug }?: AuthkitMiddlewareOptions): NextMiddleware;
6
+ export {};
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.authkitMiddleware = void 0;
4
+ const session_js_1 = require("./session.js");
5
+ function authkitMiddleware({ debug = false } = {}) {
6
+ return function (request) {
7
+ return (0, session_js_1.updateSession)(request, debug);
8
+ };
9
+ }
10
+ exports.authkitMiddleware = authkitMiddleware;
11
+ //# sourceMappingURL=middleware.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"middleware.js","sourceRoot":"","sources":["../../src/middleware.ts"],"names":[],"mappings":";;;AACA,6CAA6C;AAM7C,SAAgB,iBAAiB,CAAC,EAAE,KAAK,GAAG,KAAK,KAA+B,EAAE;IAChF,OAAO,UAAU,OAAO;QACtB,OAAO,IAAA,0BAAa,EAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACvC,CAAC,CAAC;AACJ,CAAC;AAJD,8CAIC"}
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ interface MinMaxButtonProps {
3
+ children?: React.ReactNode;
4
+ minimizedValue: '0' | '1';
5
+ }
6
+ export declare function MinMaxButton({ children, minimizedValue }: MinMaxButtonProps): React.JSX.Element;
7
+ export {};