diff --git a/.vscode/settings.json b/.vscode/settings.json index 4aa2e10c4..ddfb4ff1c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -33,6 +33,7 @@ "Emailable", "EMESSAGE", "Falsey", + "Featurebase", "fkey", "frontends", "geoip", diff --git a/apps/dashboard/.env b/apps/dashboard/.env index 83c48bc03..30a8a440b 100644 --- a/apps/dashboard/.env +++ b/apps/dashboard/.env @@ -12,5 +12,5 @@ NEXT_PUBLIC_STACK_SVIX_SERVER_URL=# For prod, leave it empty. For local developm NEXT_PUBLIC_STACK_HEAD_TAGS='[{ "tagName": "script", "attributes": {}, "innerHTML": "// insert head tags here" }]' STACK_DEVELOPMENT_TRANSLATION_LOCALE=# enter the locale to use for the translation provider here, for example: de-DE. Only works during development, not in production. Optional, by default don't translate NEXT_PUBLIC_STACK_ENABLE_DEVELOPMENT_FEATURES_PROJECT_IDS='["internal"]' - NEXT_PUBLIC_STACK_DEBUGGER_ON_ASSERTION_ERROR=# set to true to open the debugger on assertion errors (set to true in .env.development) +STACK_FEATUREBASE_JWT_SECRET=# used for Featurebase SSO, you probably won't have to set this diff --git a/apps/dashboard/.env.development b/apps/dashboard/.env.development index 8e8c4b741..9cb84bc67 100644 --- a/apps/dashboard/.env.development +++ b/apps/dashboard/.env.development @@ -8,3 +8,5 @@ NEXT_PUBLIC_STACK_SVIX_SERVER_URL=http://localhost:8113 STACK_ARTIFICIAL_DEVELOPMENT_DELAY_MS=50 NEXT_PUBLIC_STACK_DEBUGGER_ON_ASSERTION_ERROR=true + +STACK_FEATUREBASE_JWT_SECRET=secret-value diff --git a/apps/dashboard/package.json b/apps/dashboard/package.json index 7372b91a5..8500c40cb 100644 --- a/apps/dashboard/package.json +++ b/apps/dashboard/package.json @@ -38,6 +38,7 @@ "clsx": "^2.0.0", "dotenv-cli": "^7.3.0", "geist": "^1", + "jose": "^5.2.2", "lodash": "^4.17.21", "lucide-react": "^0.508.0", "next": "15.4.1", diff --git a/apps/dashboard/src/app/(main)/integrations/featurebase/sso/page.tsx b/apps/dashboard/src/app/(main)/integrations/featurebase/sso/page.tsx new file mode 100644 index 000000000..e0ab747ac --- /dev/null +++ b/apps/dashboard/src/app/(main)/integrations/featurebase/sso/page.tsx @@ -0,0 +1,44 @@ +import { stackServerApp } from "@/stack"; +import { getEnvVariable } from "@stackframe/stack-shared/dist/utils/env"; +import { urlString } from "@stackframe/stack-shared/dist/utils/urls"; +import * as jose from "jose"; +import { redirect } from "next/navigation"; + +export default async function FeaturebaseSSO({ + searchParams, +}: { + searchParams: Promise<{ return_to?: string }>, +}) { + const { return_to: returnTo } = await searchParams; + + if (!returnTo) { + return