Skip to content

Commit 17fe06b

Browse files
atrakhConvex, Inc.
authored andcommitted
dashboard: use workos authkit (#39864)
Migrates the dashboard to use WorkOS authkit instead. GitOrigin-RevId: 38772eee352184fd54c8f5d423a631559e78abb6
1 parent db74263 commit 17fe06b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1331
-1205
lines changed

npm-packages/common/config/rush/pnpm-lock.yaml

Lines changed: 223 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
NEXT_PUBLIC_ENVIRONMENT=development
22
NEXT_PUBLIC_BIG_BRAIN_URL=http://127.0.0.1:8050
33
NEXT_PUBLIC_LAUNCHDARKLY_SDK_CLIENT_SIDE_ID=62bcace88926d71668815c48
4-
AUTH0_BASE_URL='http://localhost:6789'
5-
NEXT_PUBLIC_AUTH0_LOGIN="http://localhost:6789/login"
64
SENTRY_IGNORE_API_RESOLUTION_ERROR=1
7-
NEXT_PUBLIC_VHS_LOGIN_PAGE=true
85
NEXT_PUBLIC_STRIPE_PUBLIC_KEY=pk_test_51LB1oCGmzIbonMxd1rIlziq9mgp1oB7PZr0dBClbi4gCtilM4vpgq7qfvze0RXHbHEnII7bIIixYpSYcY0C8ZDxa00GfjVTDRi
96
NEXT_PUBLIC_POSTHOG_KEY=phc_JDNTRxeh2li2sQTRO0IcOYMJcp8fPs5nTK9TU751nQK
107
# This is the Analytics Proxy (AP) for PostHog.
118
NEXT_PUBLIC_POSTHOG_HOST=https://ap.convex.dev
129
NEXT_PUBLIC_VERCEL_INTEGRATION_SLUG=convex-test
13-
NEXT_PUBLIC_AUTH0_ISSUER_BASE_URL="https://convexdev-test.us.auth0.com"
10+
WORKOS_REDIRECT_URI=http://127.0.0.1:6789
11+
WORKOS_LOGIN_URL=https://cheerful-lake-55-staging.authkit.app
12+
WORKOS_CLIENT_ID=client_01K0YV0SBXKEG7J238419105J0

npm-packages/dashboard/.env.production

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ SENTRY_DSN=https://[email protected]/63
44
NEXT_PUBLIC_SENTRY_DSN=https://[email protected]/6348388
55
NEXT_PUBLIC_LAUNCHDARKLY_SDK_CLIENT_SIDE_ID=62bcace88926d71668815c49
66
NEXT_PUBLIC_ENVIRONMENT=production
7-
NEXT_PUBLIC_AUTH0_BASE_URL=$VERCEL_BRANCH_URL
7+
WORKOS_REDIRECT_URI_OVERRIDE=$VERCEL_BRANCH_URL
88
NEXT_PUBLIC_STRIPE_PUBLIC_KEY=pk_live_51LB1oCGmzIbonMxdgup6xlzEWt2iSA42yH5wBPGhqCwDnTgSD3PbH7y1U352IUyxTUP5BL7edcJR6PLx22x1DiAs00c7iyPHtB
99
NEXT_PUBLIC_POSTHOG_KEY=phc_JDNTRxeh2li2sQTRO0IcOYMJcp8fPs5nTK9TU751nQK
1010
# This is the Analytics Proxy (AP) for PostHog.
1111
NEXT_PUBLIC_POSTHOG_HOST=https://ap.convex.dev
12-
NEXT_PUBLIC_VERCEL_INTEGRATION_SLUG=convex
12+
NEXT_PUBLIC_VERCEL_INTEGRATION_SLUG=convex
13+
WORKOS_LOGIN_URL=https://login.convex.dev
14+
WORKOS_CLIENT_ID=client_01K0YV0SNPRYJ5AV4AS0VG7T1J

npm-packages/dashboard/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ npm run pullEnv
4141
Run `just run-dash`. It will prompt you to start big brain, in which case run
4242
`just run-dash` again in another terminal.
4343

44-
Log in to the dashboard with a GitHub account (which will create an account on
45-
our development Auth0 instance).
44+
Log in to the dashboard with, which will create an account on our staging WorkOS
45+
instance.
4646

4747
### Reset big brain
4848

@@ -107,6 +107,8 @@ For this, we will proxy big brain via a cors proxy. Set these values in
107107
`.env.local`. Some must be copied from
108108
[Production vercel env vars](https://vercel.com/convex-dev/dashboard/settings/environment-variables)
109109

110+
<!--TODO: Ari update these-->
111+
110112
```
111113
NEXT_PUBLIC_BIG_BRAIN_URL=http://localhost:8080/https://api.convex.dev
112114
AUTH0_CLIENT_ID=nANKpAFe4scUPxW77869QHVKYAgrPwy7

npm-packages/dashboard/checkBigBrain.mjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ import dotenv from "dotenv";
77

88
dotenv.config({ path: ".env.development" });
99

10+
if (!process.env.WORKOS_API_SECRET) {
11+
console.error(
12+
chalk.red(
13+
"WORKOS_API_SECRET environment variable is not set. For local development, you can set it by running `npm run pullEnv`",
14+
),
15+
);
16+
process.exit(1);
17+
}
18+
1019
const parsedUrl = url.parse(process.env.NEXT_PUBLIC_BIG_BRAIN_URL);
1120
http
1221
.request(

npm-packages/dashboard/next.config.js

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,19 @@
11
const { withSentryConfig } = require("@sentry/nextjs");
22
const { DefinePlugin } = require("webpack");
3-
const path = require("path");
43

54
const ContentSecurityPolicy = `
65
frame-ancestors 'self';
76
`;
87

98
const allowedImageDomains = [
10-
{
11-
protocol: "https",
12-
hostname: "avatars.githubusercontent.com",
13-
pathname: "**",
14-
},
15-
{
16-
protocol: "https",
17-
hostname: "s.gravatar.com",
18-
pathname: "**",
19-
},
209
{
2110
protocol: "https",
2211
hostname: "**.convex.cloud",
2312
pathname: "/api/storage/**",
2413
},
2514
{
2615
protocol: "https",
27-
hostname: "lh3.googleusercontent.com",
28-
pathname: "**",
29-
},
30-
{
31-
protocol: "https",
32-
hostname: "cdn.auth0.com",
16+
hostname: "workoscdn.com",
3317
pathname: "**",
3418
},
3519
];
@@ -89,6 +73,16 @@ const nextConfig = {
8973
},
9074
async redirects() {
9175
return [
76+
{
77+
source: "/login",
78+
destination: "/api/auth/login",
79+
permanent: false,
80+
},
81+
{
82+
source: "/signup",
83+
destination: `${process.env.WORKOS_LOGIN_URL}/sign-up`,
84+
permanent: false,
85+
},
9286
{
9387
source: "/teams/:teamId*",
9488
destination: "/",
@@ -128,13 +122,7 @@ const nextConfig = {
128122
domains:
129123
process.env.VERCEL_ENV === "production"
130124
? undefined
131-
: [
132-
"127.0.0.1",
133-
"s.gravatar.com",
134-
"avatars.githubusercontent.com",
135-
"lh3.googleusercontent.com",
136-
"cdn.auth0.com",
137-
],
125+
: ["127.0.0.1", "workoscdn.com"],
138126
remotePatterns: allowedImageDomains,
139127
},
140128
experimental: {

npm-packages/dashboard/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
"checkApiSpec": "openapi-typescript ./dashboard-openapi.json --output ./src/generatedApi.ts --root-types --root-types-no-schema-prefix --check || (echo 'Dashboard API spec check failed. Run `just format-js` to fix.'; false)"
2323
},
2424
"dependencies": {
25-
"@auth0/nextjs-auth0": "3.7.0",
2625
"@convex-dev/design-system": "workspace:*",
2726
"@headlessui/react": "1.7.19",
2827
"@heroicons/react": "2.2.0",
@@ -60,7 +59,9 @@
6059
"posthog-js": "~1.256.0",
6160
"shx": "~0.3.4",
6261
"cmdk": "~1.1.1",
63-
"react-hotkeys-hook": "~4.4.0"
62+
"react-hotkeys-hook": "~4.4.0",
63+
"@workos-inc/authkit-nextjs": "~2.4.6",
64+
"@workos-inc/node": "~7.64.0"
6465
},
6566
"devDependencies": {
6667
"@babel/core": "^7.27.1",

npm-packages/dashboard/src/api/profile.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -91,23 +91,6 @@ export function useListIdentities() {
9191
return identities;
9292
}
9393

94-
export function useSetLinkIdentityCookie() {
95-
return useBBMutation({
96-
path: "/set_jwt_cookie",
97-
pathParams: undefined,
98-
includeCredentials: true,
99-
});
100-
}
101-
102-
export function useLinkIdentity() {
103-
return useBBMutation({
104-
path: "/link_identity",
105-
pathParams: undefined,
106-
mutateKey: "/list_identities",
107-
includeCredentials: true,
108-
});
109-
}
110-
11194
export function useUnlinkIdentity() {
11295
return useBBMutation({
11396
path: "/unlink_identity",

npm-packages/dashboard/src/components/header/DashboardHeader.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useAuth0 } from "hooks/useAuth0";
1+
import { useWorkOS } from "hooks/useWorkOS";
22
import { ChevronLeftIcon } from "@radix-ui/react-icons";
33
import { BreadcrumbLink } from "components/header/BreadcrumbLink/BreadcrumbLink";
44
import { Header } from "components/header/Header/Header";
@@ -47,7 +47,7 @@ const NO_TEAM_ROUTES = [
4747
const NO_HEADER_ROUTES = ["/oauth/authorize/project", "/oauth/authorize/team"];
4848

4949
function DashboardHeaderWhenLoggedIn() {
50-
const { user } = useAuth0();
50+
const { user } = useWorkOS();
5151
const router = useRouter();
5252

5353
const projectSlug = router?.query.project as string;

npm-packages/dashboard/src/components/header/Header/Header.stories.tsx

Lines changed: 0 additions & 70 deletions
This file was deleted.

0 commit comments

Comments
 (0)