/descope-skills:fusionauth-to-descopefrom descope-skills
Guides migration from FusionAuth to Descope with a structured plan covering tenants, applications, registrations, roles, login pages, lambdas, webhooks, identity providers, MFA, passkeys, SCIM, and password hash export.
Ships in descope-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
This skill guides self-service migrations from FusionAuth to Descope, in order:
MIGRATION-PLAN.md for the user to reviewDo not collapse these parts or skip ahead. The plan must be reviewed before code changes begin. If the file view is truncated, partial, or cut off, continue reading with the appropriate offset until all lines have been loaded; do not proceed based on a partial read.
FusionAuth is an OAuth 2.0 / OIDC identity server that teams either run themselves (Docker, Kubernetes, a VM — backed by PostgreSQL or MySQL and an optional Elasticsearch/OpenSearch) or rent as FusionAuth Cloud. Its model is built from tenants (hard isolation boundaries with their own user pool, keys, and policies), applications (OAuth clients that define their own roles), registrations (which user may use which application, with which roles), and groups (bundles of application roles). Around that sit hosted login pages styled with FreeMarker themes, JavaScript lambdas that run at fixed points, webhooks, identity providers for social and enterprise SSO, connectors for pulling users in from a legacy store, entity management for machine-to-machine access, MFA, passkeys, and SCIM.
Two things make FusionAuth migrations different from most others, and the plan should lead with both:
salted-pbkdf2-hmac-sha256) imports into Descope directly, so most users keep their
passwords and nobody notices the switch.next-auth, openid-client, Spring Security, ASP.NET AddOpenIdConnect, or AppAuth. Those
apps can often keep their OIDC library and just point it at Descope.Primary references (all in this skill's directory):
references/implementation-nuances.md — verified migration patterns for each framework, FusionAuth feature-to-Descope mappings, the export and password-hash recipe, and known gotchasreferences/flows-and-widgets.md — Descope terminology/lingo, Flow structure and templates, Widgets, SSO Setup Suite, Console-vs-code decision guidereferences/fusionauth-detection-patterns.md — codebase search commands for every FusionAuth SDK, generic-OIDC integration, self-hosted infrastructure, lambda, and webhook surface, plus common env varsConsole-first. Before recommending SDK code for any user-facing auth feature, check whether the Console, a Flow, a Widget, or the SSO Setup Suite covers the use case. Engineers integrate once (SDK setup + session validation). All subsequent auth evolution — new methods, MFA changes, UI updates, tenant SSO onboarding — should happen in the Console without code deployments. See references/flows-and-widgets.md → Console vs. Code.
In a FusionAuth migration this applies to three things the team may think of as code: FreeMarker themes (become a Flow plus Styles), lambdas (mostly become JWT Templates, Flow steps, or Connectors), and app-built admin screens written against the FusionAuth API because FusionAuth has no end-customer admin portal by default (often become Widgets or the SSO Setup Suite).
Match first, then enhance. Rebuild what FusionAuth does today 1:1 — same sign-in methods, same
login model, same tenants and roles — so every test has one question: does the app behave the same
as before? Passkeys, adaptive MFA, or a redesigned login are post-cutover improvements: list them in
MIGRATION-SUMMARY.md, don't build them into the migration.
Ask, don't assume. At every design decision — what a FusionAuth tenant becomes, what an
Application becomes, how registrations and groups flatten into roles, password strategy, keep the OIDC
library vs. adopt the Descope SDK, Widget vs. custom page — use AskUserQuestion rather than
proceeding with an assumption. A wrong assumption compounds across 20+ files.
MCP over memory. When a Descope MCP is connected (confirmed in Part 1), use
docs_ask_question (Descope MCP Server) or ask-question-about-descope (Docs MCP) to verify every
SDK method name, option shape, and return type before writing it. Do not write a method name and add
a hedge like "verify the exact name" — verify it.
Verify FusionAuth usage before you map it. FusionAuth apps integrate in at least four ways — the
React/Vue/Angular SDKs (with a Hosted Backend or DPoP), a generic OIDC library, the
FusionAuthClient Management API client, and direct calls to /api/login — and many use more than
one. Confirm what the app actually does before mapping anything.
Settle the tenant question first. A FusionAuth tenant can be an environment, a B2B customer, or a separate product. Each becomes something different in Descope (a Project or a Tenant), and that choice shapes the user import, roles, SSO, and every claim read. Decide it in triage.
FusionAuth configuration often lives outside the repo. Tenants, applications, roles, lambdas,
themes, identity providers, and webhooks are configured in the FusionAuth admin UI, through
Kickstart, or with the FusionAuth Terraform provider. Ask for them, export them, or read
kickstart.json, rather than inferring the auth experience from code alone.
salted-hmac-sha256, salted-md5, and iterated
salted-sha256 have no documented Descope equivalent. Count users per scheme before committing to
a plan, and give those users a JIT or reset path.active status, and none is
locked or blocked by a user action; send the rest to manual resolution (Step 4 → Email Uniqueness Across Tenants). An unverified
record winning a merge is an account takeover.iss/kid only to pick the
verifier; each branch verifies the signature against that provider's keys.DESCOPE_MANAGEMENT_KEY or Inbound App client secrets client-side.First run Part 1.5's quick grep (no questions). If it already says stop, stop there without asking about the MCP. Otherwise check which Descope MCP is connected:
docs_search with a simple query (e.g., "session validation").
It searches the docs and can also read and change the Descope project.search-descope-docs.If the Descope MCP Server is connected: proceed to Part 1.5.
If it isn't, show this message and use AskUserQuestion:
Connect the Descope MCP Server. This skill uses it to check current SDK methods and features, and it can read your Descope project and make management changes to it with your approval. Without it, guidance may be stale. Server URL
https://mcp.descope.com(other regions and client setup: https://docs.descope.com/mcp/mcp-server).For docs lookups only, you can connect the Descope Docs MCP instead:
https://docs-mcp.descope.com/mcp.Connect it before we continue, or proceed without it?
docs_search, then
search-descope-docs if that fails. If only the Docs MCP responds, continue as "Proceed with
only the Docs MCP" below.Changes through the Descope MCP Server. Name the project on every call: projectId on the
*_read / *_write tools, args.projectId on session actions. Use the Project ID the user
confirmed for this migration (recorded in MIGRATION-STATE.md, and the app's DESCOPE_PROJECT_ID
once set). Get the user's approval for each change before making it. If the session tool lists the
selectProject and elevate actions, also select the project before the first change and elevate
(session → elevate) after each approval. If the user declines, skip the change. If any other step
fails, leave it in the Console Setup Checklist for the user to do.
Do not proceed to Part 1.5 until this step is resolved.
Before triage, confirm the app uses FusionAuth. Quick check (case-insensitive): grep the repo for
fusionauth (packages, imports, FUSIONAUTH_ env vars, fusionauth/fusionauth-app images,
kickstart.json, next-auth/providers/fusionauth).
| What the repo shows | Result |
|---|---|
| Any FusionAuth package, import, env var, Docker image, Kickstart file, or Auth.js FusionAuth provider | FusionAuth — proceed |
A generic OIDC library whose issuer/authority is a FusionAuth host (*.fusionauth.io, or a self-hosted host serving /oauth2/authorize and /api/ paths) | FusionAuth — proceed, and note "no FusionAuth SDK" |
| Another identity provider (Auth0, Okta, Frontegg, WorkOS, Stytch, PingOne, Azure AD B2C, Cognito, Keycloak, Clerk) | Stop and name the matching skill if one exists (auth0-to-descope, okta-cis-to-descope, frontegg-to-descope, workos-to-descope, stytch-to-descope, pingone-to-descope, azure-ad-b2c-to-descope); otherwise point to docs.descope.com/migrate |
| A generic OIDC library with the issuer only in a secrets store, app settings, or a pipeline | Ask |
When asking, use AskUserQuestion: "Which service does this app sign in with?" — FusionAuth / Other
(name it). Proceed only on an explicit "FusionAuth". The code wins over the request: if the user says
"FusionAuth" but the repo shows another provider, ask.
When stopping, say what you found and where to go:
This skill covers FusionAuth only. This app signs in with (
<file>:<line>). <Use the<skill-name>skill | See docs.descope.com/migrate>. No code was changed.
Part 2 has two sub-steps:
MIGRATION-PLAN.md, and pause for reviewScan before you ask. If there's a codebase available, run Step 1's searches (or at minimum the
broad sweep, search 1, plus searches 4 and 5 for generic-OIDC apps) before Step 0's
AskUserQuestion calls — silently, as a normal tool call, not as something that needs permission.
Scanning is free, non-destructive, and turns generic multiple-choice questions into specific,
pre-filled ones: naming the actual framework and integration style found rather than offering a menu,
presenting a detected self-hosted deployment as a confirmation, reading tenants and roles straight out
of a kickstart.json, and skipping questions for categories the scan found zero evidence of. Triage
then does two things: confirms what the scan found and asks only what code cannot reveal —
production user counts, what each FusionAuth tenant represents, where FusionAuth runs, which hash
schemes exist, migration goal, and whether lambdas or webhooks live only in the admin UI. This still
requires AskUserQuestion for both calls below; it changes what the questions contain and how many
are asked, not whether the step happens.
Scale the question count to the project. A single-tenant app with one Application and a handful of components does not need the same triage volume as a multi-tenant B2B platform with groups, lambdas, and enterprise SSO. If the scan shows no evidence of a feature category (entities, SCIM, connectors, consents, families, gaming IdPs, etc.), it's reasonable to state "no evidence found for X — confirm out of scope?" as a single grouped question rather than working through the full catalogue.
AskUserQuestion)Use the AskUserQuestion tool to gather the information below, informed by whatever the codebase
scan already found. Do not infer answers from memory, prior conversations, or assumptions the scan
didn't actually confirm — even if you think you know.
The migration path differs based on these answers; getting them wrong wastes the user's
time and produces incorrect guidance.
Do not proceed to Step 0.5 until the user has answered.
First AskUserQuestion call (up to 4 questions):
@fusionauth/typescript-client",
"Spring Boot OAuth2 client"). The integration style matters more than the language here:
next-auth, openid-client, Spring Security, ASP.NET, authlib,
AppAuth) → either keep the library and repoint it at Descope as the OIDC provider, or adopt the
Descope SDK. Ask which they prefer (see Step 1.5 item 3).POST /api/login from the app's own login form) → the app owns its login
UI today; Descope replaces it with a Flow, or the Descope SDK's password method if they insist on
keeping the custom form.fusionauth/fusionauth-app image, Helm chart, or
FUSIONAUTH_APP_* server variables (self-hosted) vs. a *.fusionauth.io URL (Cloud).Second AskUserQuestion call — FusionAuth feature usage (use multiSelect: true):
applicationId / aud.superRole / default roles are used.memberships, a lambda putting groups into the token).idp_hint), whether FusionAuth is itself the IdP for downstream apps (SAML v2 IdP or OIDC), and whether reconcile lambdas map roles from IdP claims.app.at / app.rt cookies) or DPoP, whether a next-auth session wraps everything, which signing key type (RSA/EC vs. HMAC) the tenant uses, and how backends validate tokens./account pages (manageAccount()), and whether tenant admins use Tenant Manager.After both calls, summarize findings and flag high-complexity items before proceeding to Step 0.5. The main high-complexity FusionAuth areas are typically what tenants become, hash schemes Descope can't import, same-email users across tenants, registrations and per-application roles, lambdas that reject or reshape logins, SCIM, enterprise SSO with reconcile lambdas, connectors still pulling users in, and HMAC-signed tokens in backends.
AskUserQuestion)These questions surface blockers the framework doesn't expose. Ask even the ones you think
you know. Use AskUserQuestion before proceeding to codebase analysis.
Read references/flows-and-widgets.md first — especially the terminology table and the
self-service mapping table. The last group of questions below asks which screens a Descope Widget or
the SSO Setup Suite can absorb; you cannot ask that usefully without knowing the catalog. The
High-Complexity FusionAuth Areas checklist in Step 3 is also worth skimming now; it is the list you
are flagging against.
Batch into calls of up to 4 questions. Skip questions that are clearly inapplicable given Step 0 answers (e.g., skip user migration planning if they said they're starting fresh).
Access and credentials
Authorization header as-is, with no Bearer prefix. A tenant-scoped key sees only one tenant; with several tenants, a global key plus the X-FusionAuth-TenantId header is easier.Codebase scope
/oauth2/authorize) or a custom form calling /api/login? Hosted maps to Descope-hosted login or an embedded Flow; a custom form maps to an embedded Flow (recommended) or the Descope SDK's password API.roles, applicationId, aud, tid, email, email_verified, preferred_username, authenticationType, sid — or custom claims added by a JWT populate lambda? These need a Descope JWT Template before equivalent reads work.HS256; the default for Kickstart and pre-1.50 installs)? The last two break silently at cutover.FusionAuthClient) at runtime — creating users, registrations, groups, or identity providers? Each call becomes a Descope Management SDK call behind a server endpoint, or a Widget.GET /api/lambda) — they are part of the auth behavior even though no file in the repo shows them.Deployment and risk
auth.myapp.com)? With the Hosted Backend this is often required, because the Hosted Backend's cookies don't work cross-site. Plan the equivalent Descope custom domain before cutover.User migration (if they indicated existing users in Step 0)
How many users, across how many tenants? With the Elasticsearch search engine on FusionAuth before 1.48.0, POST /api/user/search stops at 10,000 results, so large exports need the database route or query slicing.
Password credentials: confirm the strategy explicitly. FusionAuth's API never returns hashes; the database does. Count users per encryption_scheme (one query, below) before picking:
hashedPassword field. Users keep their passwords with no extra step. Supported mapping:
salted-pbkdf2-hmac-sha256 (FusionAuth's default) → pbkdf2 with type: "sha256", iterations = factorsalted-pbkdf2-hmac-sha512-512 → pbkdf2 with type: "sha512"salted-pbkdf2-hmac-sha256-512 → pbkdf2 with type: "sha256" — test with a real sign-in first; FusionAuth uses a 512-bit key here and Descope takes no key-length fieldbcrypt → bcrypt with the full $2a$<factor>$<salt><hash> string rebuilt from FusionAuth's separate columnsphpass-md5 / phpass-sha512 → phpass — test with a real sign-in firstsalted-md5, salted-sha256 with factor > 1, salted-hmac-sha256, and any custom plugin scheme → not importable; use option 2 for those usersfreshlyMigrated on users without an importable hash. During a transition, the sign-in Flow sends those users through a Generic HTTP Connector that calls FusionAuth's Login API (POST /api/login) so FusionAuth checks the password and Descope stores it (imported users need one OTP or magic-link step first, because storing a password on an existing user uses Update Password). Also the right choice when the hash export is delayed: import profiles now, add hashes later, and let JIT cover the gap.Any option that uses JIT keeps FusionAuth running for a transition period. Ask how long the user can keep it on, and recommend at least a few months when passwords matter. See references/implementation-nuances.md → Migrating users and tenants.
Does the same email exist in more than one FusionAuth tenant? If those tenants become Descope tenants in one project, those records merge into one Descope user. Auto-merge only when every record has a verified email, the same active status, and no lock or login-blocking user action, picking the password, name, and TOTP seed from one record (usually the most recent last_login_instant). Send unverified or conflicting duplicates to manual resolution, or keep those tenants as separate Projects (Step 4 → Email Uniqueness Across Tenants explains why). Run the duplicate-count query in the export recipe before estimating, and tell affected users which password still works.
Which identifier do users sign in with? Email, username, or both. Descope takes one loginId plus additional login IDs; users with both need a rule for which is primary.
Is user.data (free-form JSON) in use? Each field the app reads becomes a Descope custom attribute, defined in the Console first. Registration-level data needs a decision too.
Are TOTP authenticators enrolled? Descope's import accepts a base32 TOTP seed, so authenticator-app MFA can carry over if the secret is in the export — confirm the secret's encoding in the export before promising it. Passkeys, email MFA, and SMS MFA enrollments do not carry over; users re-enroll.
Big-bang cutover or phased? Map each FusionAuth tenant to its Descope target first — user import, roles, SSO, and SCIM all depend on it.
SCIM is a lifecycle system, not a one-time import. If FusionAuth's SCIM server is in use, customer directories keep pushing create/update/deactivate events after cutover. Re-point every SCIM client at Descope before cutover, or provisioning silently breaks.
Are they aware that active FusionAuth sessions end at cutover unless dual token validation is used? Plan for forced re-login or a phased rollout.
Does the app store FusionAuth user IDs (UUIDs), tenant IDs, application IDs, or group IDs in its own database? If yes, keep the FusionAuth user ID as a custom attribute (fusionauthId) and plan an ID mapping table.
Gaps to flag immediately (don't ask — flag these proactively based on Step 0 answers)
billing:admin).Console/Flow/Widget opportunities (flag before codebase analysis, then ask):
/account pages: ask whether the User Profile Widget replaces them./api/user, /api/user/registration, or /api/group/member: ask whether the User Management or Role Management Widget covers it.Summarize any blockers and Console/Flow/Widget opportunities before proceeding to codebase analysis.
Scan the codebase to map every auth touchpoint before writing the plan.
FusionAuth apps integrate through some mix of:
@fusionauth/react-sdk (FusionAuthProvider, useFusionAuth(), RequireAuth, Unauthenticated, login/logout/register/account buttons), @fusionauth/vue-sdk (FusionAuthVuePlugin / createFusionAuth, useFusionAuth(), RequireAuth, RequireAnonymous), @fusionauth/angular-sdk (FusionAuthModule.forRoot, FusionAuthService, <fa-login>). By default they call a Hosted Backend (/app/login, /app/callback, /app/refresh, /app/me, /app/logout) that keeps tokens in app.at / app.rt / app.idt / app.at_exp cookies; with useDpop: true they call FusionAuth's OAuth endpoints directly.next-auth with next-auth/providers/fusionauth (or Auth.js @auth/core/providers/fusionauth). There is no official FusionAuth Next.js SDK.openid-client, passport-openidconnect, Spring Security OAuth2 client/resource server, ASP.NET AddOpenIdConnect / AddJwtBearer, authlib, golang.org/x/oauth2 + go-oidc, AppAuth on mobile, flutter_appauth, react-native-app-auth.@fusionauth/typescript-client, fusionauth-client (Python), github.com/FusionAuth/go-client, io.fusionauth:fusionauth-java-client, FusionAuth.Client (.NET), fusionauth_client (Ruby), fusionauth/fusionauth-client (PHP).fusionauth-swift-sdk (iOS) and io.fusionauth:fusionauth-android-sdk, both built around AuthorizationManager. Flutter and React Native use AppAuth wrappers.Run the searches in references/fusionauth-detection-patterns.md (broad sweep, frontend SDKs,
backend clients, token claims and OAuth endpoints, env vars, self-hosted infrastructure, mobile,
dependency manifests, webhooks and lambdas). Read the notes beside each search: several exist to catch
a case the obvious grep misses (generic-OIDC apps with no FusionAuth package; HMAC verification;
kickstart.json and .ftl theme files; lambdas kept as .js files).
For each hit, record:
Read package.json (or equivalent) for the exact framework and SDK versions. For next-auth, note
v4 vs. Auth.js v5 — the config file shape and env var names differ. Next.js version also affects async
behavior (15 vs. 14). If a kickstart.json exists, read it fully: it is an inventory of tenants,
applications, roles, lambdas, keys, and webhooks.
If a Descope MCP is connected, use docs_search or docs_ask_question (Descope MCP Server) or
search-descope-docs or ask-question-about-descope (Docs MCP) to verify current SDK method names for anything you plan to reference in the plan.
Write MIGRATION-PLAN.md to the working directory using the triage answers and codebase
analysis.
Two audiences: the engineer needs enough technical detail to execute; the PM or tech lead needs scope, risk, and timeline without decoding jargon. Use plain English. Explain technical terms on first use. Open each section with a sentence summarizing what it means before presenting tables or evidence. Say what breaks if a risk is missed, not just that it exists. Pair complexity labels with time estimates; skew toward the lower bound — SDK swaps and mechanical rewrites are usually faster than they look, and repetitive files in a group after the first go much faster. Group execution into phases so parallel vs. sequential work is clear.
The plan must include these sections, in this order:
2–3 sentences: what's being replaced, what replaces it, and the recommended approach with a one-sentence rationale. Add one sentence on what doesn't change — the login model, sign-in methods, tenants, roles, and (with a hash import) passwords carry over — and one on what does: active FusionAuth sessions end at cutover, so users sign in once more.
Include a Migration at a Glance table:
| Approach | Full migration with password hashes (+ JIT for N users on unsupported schemes) |
| FusionAuth tenants become | Descope Projects (environments) / Descope Tenants (customers) |
| Login model | FusionAuth hosted pages → Descope-hosted login / embedded Flow; OIDC library kept or replaced |
| Files changing | N source files across N areas |
| Console setup | N configuration steps before launch |
| User impact | Users sign in once after cutover with their existing password; passkeys and SMS/email MFA re-enroll |
| Estimated engineering effort | N–N hours |
| Biggest risk | One sentence naming the highest-complexity item |
Prose (not a table) describing what each part of the system does today and what it does after. Example:
Today, FusionAuth handles everything related to login. The React app wraps itself in
FusionAuthProviderand sends users to FusionAuth's hosted login page; FusionAuth's Hosted Backend stores the access and refresh tokens inapp.atandapp.rtcookies, and the Express API readsapp.at, verifies it against FusionAuth's JWKS, and checks therolesclaim for theadminrole on theapplicationIdit expects. After this migration, Descope takes over all of those responsibilities. The login UI becomes a Descope Flow on a Descope-hosted page. Session validation moves to the Descope SDK, reading theDScookie. FusionAuth application roles become Descope roles.FUSIONAUTH_URL,FUSIONAUTH_CLIENT_ID, andFUSIONAUTH_API_KEYare replaced byDESCOPE_PROJECT_ID(plus a Management Key for server-side administration), and the FusionAuth server, database, and search cluster can be shut down after the transition.FusionAuth features in use that need to carry over: [list in plain English, one clause each].
Tailor to triage findings.
For every FusionAuth touchpoint found in triage, produce a concrete, one-to-one mapping — FusionAuth construct → the exact Descope SDK and method that replaces it — and state explicitly whether that replacement runs in the client SDK or the backend SDK, and why. Use this division of responsibility:
@descope/web-js-sdk, @descope/react-sdk, @descope/vue-sdk,
@descope/angular-sdk, @descope/nextjs-sdk client components, or the <descope-wc> web
component) — everything the user's browser or mobile app does: rendering the login/sign-up UI (a
Descope Flow replaces FusionAuth's hosted pages or the app's custom login form), initiating
authentication, holding the session, refreshing the token, and reading the current user for UI
purposes. This replaces FusionAuthProvider / FusionAuthVuePlugin / FusionAuthModule,
useFusionAuth() (isLoggedIn, userInfo, startLogin, startLogout, refreshToken),
RequireAuth / Unauthenticated, and the Hosted Backend round-trips. It uses only the public
Project ID — never a Management Key.@descope/node-sdk, descope (Python), github.com/descope/go-sdk, etc.) —
everything the server does: validating the session JWT on every request (replacing JWKS or HMAC
verification of app.at / Bearer tokens, validateJWT, Spring resource-server config, AddJwtBearer),
checking roles and permissions, and — with a Management Key — all administrative operations by ID
(user, tenant, role, SSO/SCIM, access-key management). This replaces every FusionAuthClient call.For each file or area, name the FusionAuth call, the Descope SDK that replaces it, which side it runs
on, and the reason (e.g. "role assignment must stay server-side because the Management Key cannot
ship to the browser"). When one FusionAuth feature spans both sides — for example RequireAuth withRole="admin" (client gate) plus a backend roles check — split it into its client half and its
backend half so the reader sees exactly what moves where, and why.
If the user chose to keep a generic OIDC library, say so here: the library stays, its issuer, client ID, and secret change, and the claim reads still change because Descope's token shape differs.
Open with the scope count (e.g., "14 files across 5 areas"). Group by area, not file path. Each group gets a sentence on what it does and what changes.
Session handling (3 files) — These files read and validate the current user's login state. They'll be updated to use the Descope session SDK instead of FusionAuth token validation.
| File | What it does today | What changes |
|---|---|---|
server/auth.ts:34 | Reads the app.at cookie and verifies it with jose against FusionAuth's JWKS; checks aud = application ID | Rewritten to call Descope validateSession() on the DS cookie; a thin adapter preserves the shape callers expect |
server/roles.ts:12 | Checks claims.roles.includes('admin') | Uses the Descope SDK's role validation helper; role names carried over from FusionAuth |
Login / auth UI (2 files) — These mount the FusionAuth provider and start the hosted login. Descope replaces this with the Descope provider plus hosted login or an embedded Flow.
| File | What it does today | What changes |
|---|---|---|
src/main.tsx | Wraps the app in FusionAuthProvider with serverUrl, clientId, redirectUri | Replaced with Descope AuthProvider projectId={...} (with oidcConfig for hosted login) |
src/Login.tsx | Renders FusionAuthLoginButton | Calls sdk.oidc.loginWithRedirect(), or renders <Descope flowId="sign-up-or-in"> |
Cover all functional groupings found — Management API calls, registration checks, webhook handlers,
M2M token issuance, mobile auth, /account links. End with:
"Total: N files. Estimated code-change effort: N–N hours."
For each FusionAuth feature confirmed in triage, write a short paragraph: what it's trying to accomplish, the best Descope approach for that goal, what's different, and what action is required. The best approach may be a Flow, Widget, SSO Setup Suite, or Console configuration rather than a direct SDK equivalent — reason about the intent, not just the API surface. Only recommend SDK code when programmatic control is genuinely required. Example:
Application roles and registrations → Descope roles In FusionAuth, each Application defines its own roles, and a user gets roles through a registration — the record that says "this user may use this application." The access token's
rolesclaim holds the roles from the registration for the application that requested the token, plus roles from any groups the user belongs to.Descope has no per-application registration. Roles are defined once per project and assigned to a user either project-wide or within a tenant. This app has one Application, so its roles (
admin,editor,viewer) become Descope roles with the same names, and each user's registration roles plus group roles are flattened onto the user at import.The request-time change is small: the code that checked
claims.rolesuses the Descope SDK's role helper instead. Users who existed in FusionAuth but had no registration for this Application (FusionAuth's "authenticated but not authorized" state) are not imported, unless the team decides otherwise.
Effort: Low (under 1 hour of code changes). Confirm the role list against
kickstart.jsonor the admin UI.
Only include confirmed features.
Some Descope behavior is configured in the console, not in code. List every item that must be set up before the app works, as checkboxes with a plain description of what it is, why it's needed, and roughly how long it takes. Group into "Required before any testing" and "Required before production":
Required before any testing:
FUSIONAUTH_URL and FUSIONAUTH_CLIENT_ID in the app's environment variables.localhost:3000, app.myapp.com) — not the full authorized redirect URLs
FusionAuth's application OAuth settings hold, like http://localhost:3000/app/callback.sign-up-or-in flow works for most apps and requires no
customization to start. Set it to the same methods FusionAuth offers today.email, email_verified, and
preferred_username. Any code reading those off the token gets nothing until this is configured.
(~10 minutes)Required before production:
fusionauthId, freshlyMigrated (if JIT is used), and every
user.data field the app reads.Diff table with plain-English notes for each removal and addition:
| Remove | Add | Why |
|---|---|---|
FUSIONAUTH_URL / FUSIONAUTH_ISSUER / FUSIONAUTH_SERVER_URL | (none) | FusionAuth's host and issuer. Descope SDKs resolve the endpoint from the Project ID; a custom domain is set in the SDK only if configured. |
FUSIONAUTH_CLIENT_ID / FUSIONAUTH_APPLICATION_ID | DESCOPE_PROJECT_ID (Descope SDK), or the Federated App's Client ID (OIDC library kept) | The FusionAuth Application ID doubled as the OAuth client ID. With the Descope SDK, the Project ID takes its place. An app that keeps its OIDC library (next-auth, Spring, ASP.NET) uses the Federated OIDC App's own Client ID — not the Project ID. |
FUSIONAUTH_CLIENT_SECRET | (none), or the Federated App's Client Secret | Only for a server-side app that keeps its OIDC library (a Confidential Federated OIDC App). SPAs and mobile apps use a Public app with PKCE and no secret. |
FUSIONAUTH_API_KEY | DESCOPE_MANAGEMENT_KEY | Used for Management API calls. Needed only if the app does server-side user/tenant/role administration. |
FUSIONAUTH_TENANT_ID | (none) or a Descope tenant ID | Only if the code scopes requests to one tenant. |
AUTH_FUSIONAUTH_* (Auth.js) | AUTH_DESCOPE_* or none | Depends on whether next-auth stays (see Step 2 → Next.js). |
(frontend) serverUrl / clientId / redirectUri in FusionAuthProvider | NEXT_PUBLIC_DESCOPE_PROJECT_ID / VITE_DESCOPE_PROJECT_ID or framework equivalent | Often hardcoded inline rather than read from env vars. |
Follow with: "Net change: N variables removed, 1–3 added. No FusionAuth secrets need rotating — they
stop being used — though FusionAuth should stay running, read-only, until the migration is verified
(and for the whole JIT transition if one is used)." If the team self-hosts, add a line that the
FusionAuth server variables (FUSIONAUTH_APP_*, DATABASE_*, SEARCH_*) belong to infrastructure
being retired, not to the app.
Prose strategy first, then steps. Start with: "X existing users across Y FusionAuth tenants need to be in Descope before cutover." Describe:
End with a brief checklist of the migration steps at the level a PM can track. The agent writes the export/import script (Step 3 → User & Tenant Data has the queries, endpoints, and mapping):
fusionauthId, freshlyMigrated, and user.data fields) in the Descope Console before the first runfreshlyMigrated and brand-new users, keep FusionAuth running for the chosen transition, then turn it off and send remaining freshlyMigrated users to reset or passwordlessinsert_instant / last_update_instant alone misses removals (see references/implementation-nuances.md → Final reconciliation at cutover)Things that could affect timeline, user experience, or scope. Write each in plain English with three parts: what it is, what breaks if it's ignored, and what to do. Format each as a named callout:
Consideration: password hashes come from the database, not the API FusionAuth's API never returns password hashes. Self-hosted teams read them from their own database; FusionAuth Cloud customers need FusionAuth support to provide a database export. If the plan assumes an API export, the hashes never arrive and every user has to reset. Action: Start the export path in week one. Count users per scheme so the JIT fallback is sized before cutover.
Consideration: a FusionAuth tenant is not a Descope tenant FusionAuth tenants are separate user pools; Descope tenants are groups of users in one pool. If customer tenants become Descope tenants, the same email in two tenants becomes one Descope user. If environment tenants are mapped to Descope tenants by mistake, dev and prod users end up in one project. Action: Record what each FusionAuth tenant becomes in the plan. Auto-merge duplicate emails only when every record is verified, has the same
activestatus, and none is locked or blocked by a user action, and send the rest to manual resolution — merging an unverified record can hand one person's account to another.
Consideration: roles were per application; Descope roles are per project Two FusionAuth Applications can both define
adminwith different meanings. Importing both as one Descopeadminrole grants access the user never had. Action: List roles by Application, and merge or prefix them deliberately.
Consideration: user profile data won't appear in the token until a JWT Template is configured FusionAuth's access token carries
email_verified, andpreferred_username; Descope's does not. Code reading them from the token gets nothing. Action: Configure the JWT Template before running any tests. Estimated time: 10 minutes.
Consideration: backends that verify with an HMAC secret break silently Installs set up through Kickstart (or before FusionAuth 1.50) sign tokens with HS256. Backends verifying with that shared secret reject every Descope token as "invalid signature", which looks like a Descope problem. Action: Find every
HS256/jwt.verify(token, secret)and replace it with Descope session validation.
Consideration: SCIM is a lifecycle system, not just a user import Customer directories keep creating, updating, and deprovisioning users after cutover. Action: Identify every SCIM client and re-point it at Descope before cutover.
Include only applicable trade-offs and considerations.
Open with one sentence: phases run in sequence; steps within a phase can run in parallel. Then labeled phases, each with a time estimate:
Phase 0 — Start the export path (day one, mostly waiting)
Phase 1 — Console Setup (~30–60 minutes, no code required) Can be done by any team member with Descope console access, in parallel with other work.
localhost:3000, not http://localhost:3000/app/callback)sign-up-or-in, set to today's methods)fusionauthId, freshlyMigrated, user.data fields)Phase 2 — Code Changes (~X–Y hours, 1 engineer) Work through files in the order listed. Run a compile check after each group.
.env.example and CI config (15 min)DS cookie (30 min)Phase 3 — User Migration (~1–3 hours, includes dry run) Run against dev/staging first. Do not run against production until Phase 4 passes.
Phase 4 — Testing (~30–45 minutes)
Phase 5 — Production Cutover
active status, roles, and tenant memberships (or freeze all FusionAuth writes from the final export to the switch)Total estimated engineering effort: N–N hours across N engineers. Blocking dependencies: (list anything on the critical path — Descope console access, FusionAuth database access or support export, SCIM re-point, MFA re-enrollment comms.)
After writing MIGRATION-PLAN.md, stop and tell the user:
MIGRATION-PLAN.mdhas been written to your working directory. It maps every auth touchpoint found, lists what needs Console setup before the first test, and calls out trade-offs and considerations that could affect the timeline.Take a look before we start making changes. When you're ready to proceed, say so.
Do not proceed to Part 3 unless the user confirms.
Execute the plan in MIGRATION-PLAN.md Execution Plan order. Follow the detailed guidance below
for each step.
Context can be lost between turns. These rules keep the migration coherent.
Step 3.0 — Create MIGRATION-STATE.md before touching any code.
Write MIGRATION-STATE.md to the working directory from the template below. It's the
source of truth for migration state — keep it current throughout execution.
# Migration State
_Last updated: [timestamp of last completed step]_
## Project Context
- Framework: [e.g., Next.js 15 + next-auth v4, Express + React]
- Language: [TypeScript / Python / Go / Java / C#]
- Package manager: [npm / yarn / pnpm / pip / etc.]
- FusionAuth integration style: [FusionAuth SDK + Hosted Backend / DPoP / generic OIDC library (kept or replaced) / custom form on /api/login]
- FusionAuth hosting: [Self-hosted vX.Y / FusionAuth Cloud]
- Migration goal: [Full cutover / Phased / Evaluating]
## Triage Answers
- Existing users: [Yes — N users / No — greenfield]
- FusionAuth tenants → Descope: [e.g. "Default → project; acme, globex → tenants"]
- Same-email duplicates across tenants: [N — merge rule: ...]
- Hash schemes: [e.g. salted-pbkdf2-hmac-sha256: N, bcrypt: N, salted-md5: N]
- Password strategy: [Import hashes / Import hashes + JIT for unsupported / Import without passwords / JIT via OIDC only]
- JIT transition length: [e.g. 3 months / none]
- Applications → Descope: [e.g. "one app → project"]
- Role mapping notes: [merged / prefixed]
- FusionAuth features in use: [comma-separated list]
- Zero-downtime required: [Yes / No]
## Files Inventory
_All files that need to change. Update status after each step._
| File | Change | Status |
|---|---|---|
| `src/main.tsx` | Replace FusionAuthProvider | ⬜ Pending |
| `server/auth.ts` | Rewrite session helper | ⬜ Pending |
| `server/roles.ts` | Update role checks | ⬜ Pending |
## Console Setup Checklist
- [ ] Descope project created — Project ID: (fill in when done)
- [ ] Approved Domains configured (domain only — e.g. `localhost:3000`, not `http://localhost:3000/app/callback`)
- [ ] Flow configured with today's sign-in methods
- [ ] JWT Template configured
- [ ] Tenants created: (list)
- [ ] Roles and permissions created: (list)
- [ ] Custom attributes defined: (list)
- [ ] SSO connections / SSO Setup Suite configured: (list)
- [ ] Social providers configured: (list providers)
## Decisions Log
_Non-obvious decisions made during migration — preserves rationale if context is lost._
_(none yet)_
## Current Phase
Phase 0 — Start the export path (not started)
## Next Action
Confirm database access or open the FusionAuth support ticket, then complete console setup per MIGRATION-PLAN.md before making any code changes.
## Blockers
_(none)_
Rule 1 — Re-read before every turn.
At the start of every execution turn, re-read MIGRATION-PLAN.md and MIGRATION-STATE.md
before writing any code or making any decision.
Rule 2 — Verify context before every code change.
If the framework, migration path, triage answers, or next step aren't clear from the conversation, re-read both files before proceeding. Then output a context line:
Migration context: Next.js 15 + next-auth · Phase 2, step 3/8 · Next: rewrite server/auth.ts
If this line can't be filled in accurately, re-read the files first.
Rule 3 — Update MIGRATION-STATE.md immediately after each step.
Mark the file done in the Files Inventory, update "Current Phase" and "Next Action", and append any non-obvious decision to the Decisions Log. Do this before the next step.
Run before generating any import, wrapper type, or helper. Skipping produces code that compiles but fails at runtime.
1. Verify SDK exports before writing any import.
When a Descope MCP is connected, use docs_ask_question (Descope MCP Server) or ask-question-about-descope (Docs MCP) to confirm the exact method name, option shape, and return type before writing any SDK call. This is faster and more reliable than reading type declarations. Do not write a method name and add a hedge like "verify the exact name" — just verify it.
When neither Descope MCP is connected: resolve the package's type declarations (node_modules/<pkg>/dist/types/ or its package.json types field) and confirm the exact exported name and signature. For Go, run go doc. For Python, check the SDK stubs.
Prefer local node_modules/ over GitHub when reading type declarations. Installed packages reflect the exact version in use. If the Descope package isn't installed yet, install it first, then read local type declarations. Only fall back to GitHub if the package can't be installed in the current environment.
This applies to every SDK call you write, not just the first import. Field names on
option objects, hook return shapes (useDescope() returns the SDK directly, not { sdk }),
and subpath exports (/client vs root) differ just as often.
1a. After rewriting any module, grep for remaining imports of the removed package.
grep -rn "@fusionauth/\|fusionauth-client\|fusionauth_client\|FusionAuth/go-client\|io\.fusionauth\|FusionAuth\.Client\|providers/fusionauth\|FusionAuthClient" \
--include="*.ts" --include="*.tsx" --include="*.js" --include="*.jsx" --include="*.vue" \
--include="*.py" --include="*.go" --include="*.rb" --include="*.php" --include="*.kt" \
--include="*.java" --include="*.cs" --include="*.swift" .
Add remaining hits to the work list.
2. Derive wrapper types from the actual return type.
Read the function's declared return type and build the wrapper to match. FusionAuth's userInfo
(OIDC userinfo: sub, email, given_name, roles, …) and decoded access-token claims are flat;
Descope's authInfo and useUser() shapes differ and nest tenant data. Don't infer one from the
other.
3. Check dependency versions before generating framework-specific code.
For Next.js: cookies() and headers() from next/headers are synchronous in v14 and
async in v15. For next-auth: v4 and v5 (Auth.js) configure providers differently. Read
package.json (or go.mod, requirements.txt) first.
4. When making a helper async, propagate to all callers immediately.
In TypeScript, async on a shared utility silently breaks callers that omit await. Grep
for all call sites of the changed function and update them in the same pass. The cascade can
span 10–20 files.
5. Verify published package versions before writing to package.json or running npm install.
Don't reuse FusionAuth's version number or rely on training data for versions. Before writing any
install command:
npm view @descope/node-sdk version
npm view @descope/react-sdk version
If npm is unavailable, leave the version as "latest" and flag it.
Several steps require Descope Console setup that can't be done in code. The app compiles without them but won't work at runtime.
Use AskUserQuestion to ask whether they already have a Project ID and working Flow. If
yes, skip to verifying items 5–9 — these are easy to miss even for existing projects.
P (e.g. P2abc123...).NEXT_PUBLIC_DESCOPE_PROJECT_ID. For all server-side SDKs, it's DESCOPE_PROJECT_ID.kickstart.json).Required for: user import, user management API, role/permission management, tenant operations, SSO/SCIM configuration, access keys, Inbound Apps. Any migration with existing users needs one.
DESCOPE_MANAGEMENT_KEY. Treat like a secret — never expose client-side.A Flow is the auth UI sequence. Reference it by Flow ID in the web component.
references/flows-and-widgets.md → Flows.Match the existing login model. Use AskUserQuestion to confirm, then follow this tree:
How does the app sign in with FusionAuth today?
├── FusionAuth React/Vue/Angular SDK → hosted pages (startLogin / FusionAuthLoginButton)
│ → Descope-hosted login: Descope SDK with oidcConfig
│ (<AuthProvider projectId oidcConfig> + sdk.oidc.loginWithRedirect())
│ → or, if they want in-page login: embedded <Descope flowId="..."/>
├── Generic OIDC library (next-auth, openid-client, Spring, ASP.NET, authlib, AppAuth)
│ Keep the library → repoint it at Descope as the OIDC provider (Federated OIDC App),
│ issuer https://api.descope.com/<ProjectID>:
│ server-side app → Confidential: the app's own Client ID + Client Secret
│ SPA / mobile app → Public: the app's Client ID + PKCE, no secret
│ Adopt Descope SDK → Descope-hosted login (oidcConfig) or embedded Flow, plus SDK session validation
├── Custom login form posting to /api/login
│ → embedded <Descope flowId="..."/> (recommended), or the SDK's password API if the
│ form must stay exactly as is (consider Bring Your Own Screen first)
└── Mobile (AppAuth / FusionAuth Swift or Android SDK)
→ Descope Flow through the native SDK, or keep AppAuth pointed at a Public
Federated OIDC App (PKCE, no secret)
Keeping the OIDC library is the smallest code change for generic-OIDC apps: the redirect round-trip, callback route, and session handling stay; only the issuer, client ID, secret, and claim reads change. Pick the Federated OIDC App's client type by where the client runs:
next-auth, Spring, ASP.NET, openid-client on a server):
use the app's own Client ID and Client Secret from its application page, and keep the
secret in the server's secret store.oidc-client-ts, flutter_appauth,
react-native-app-auth): use the app's Client ID with Authorization Code + PKCE and no secret.
A client secret in a browser bundle or mobile binary can be extracted by anyone.The client ID is the Federated App's Client ID, not the Project ID. Don't use the Access Key
(legacy) mode, where the Project ID is the client ID and an Access Key is the secret. Verify the
current Federated App setup and endpoints with the MCP
(OIDC Federated Applications).
If the app's frontend calls its own API with scoped access tokens, use an Inbound App and Resource
instead. The trade-off: the app does not get Descope's client SDK helpers (useSession, Widgets) for
free; those can be added later.
Adopting the Descope SDK with oidcConfig keeps the same redirect UX FusionAuth's hosted pages
gave: the SDK redirects to the Descope-hosted page and back, and sdk.oidc.logout({ post_logout_redirect_uri }) replaces FusionAuth's /oauth2/logout. Verify the oidcConfig options for
the user's SDK via the MCP (React guide).
Ask whether FusionAuth runs behind a custom domain. With FusionAuth's Hosted Backend this is usually a requirement (its cookies don't work cross-site); either way, plan the Descope custom domain before cutover. Switching login models mid-migration changes routing, redirect handling, and session bootstrapping all at once, so change the model only when the user explicitly asks.
GET /api/identity-provider) into Descope, then add Descope's redirect URL in the provider's developer console. Check FusionAuth's gaming providers (Steam, Twitch, Xbox, Epic, Nintendo, Sony PSN) and HYPR against Descope's provider list before promising them — use a custom OAuth provider where Descope has no built-in one.Console → Project Settings → General → Security → Approved Domains.
Descope validates redirect URLs against this domain list — not full redirect URIs the way
FusionAuth's application "Authorized redirect URLs" do. Enter domain only: no http:// or
https://, no path.
localhost:3000 (include port)myapp.com or app.myapp.comDo not carry over FusionAuth redirect URLs like http://localhost:3000/app/callback or
http://localhost:3000/api/auth/callback/fusionauth. If the app keeps a generic OIDC library, its
callback URL is registered on the Descope Federated App instead. Note that FusionAuth supports
wildcard redirect URLs — confirm how any wildcard entry should be represented before assuming a
one-to-one copy.
FusionAuth's access token carries email, email_verified, and preferred_username, plus whatever a
JWT populate lambda adds. Descope's session token carries none of those by default.
{"email": "{{user.email}}", "name": "{{user.name}}"} and any others the app reads.
To confirm the exact placeholder syntax in any given project rather than trusting memory, read the
built-in "Default OIDC compliant User JWT" template that ships with every project — it already
uses {{user.email}}.authSchema: "default" on the template. Without it, the tenants/roles/permissions
claims are omitted from the token even if the app otherwise looks correctly configured.ValidateJwtTemplate operation (dry-run) — either via
the Descope MCP if available, or the equivalent Console preview.token.email gets
undefined after migration.jwt.someClaim = user.data.someField becomes a template claim reading the matching custom
attribute. See Step 3 → Lambdas.Descope roles are referenced by name, not by ID. They must be created before the import assigns them.
GET /api/application returns each Application's roles).
If two Applications define the same role name with different meanings, prefix or rename before
creating (e.g. billing:admin). Record the mapping in the Decisions Log.superRole flag and default roles (isDefault, assigned on registration) become a
documentation note and a Flow step that assigns the default role on sign-up.fusionauthId (string) and, if JIT is used, freshlyMigrated (boolean), plus one attribute
per user.data field the app reads. Nested user.data objects need a flattening decision.true, not "true", for a boolean.| Variable | Where to get it | Used by |
|---|---|---|
DESCOPE_PROJECT_ID | Console → Project Settings | All server-side SDKs |
NEXT_PUBLIC_DESCOPE_PROJECT_ID | Same value as above | Next.js AuthProvider (client-side) |
DESCOPE_MANAGEMENT_KEY | Console → Company Settings → Management Keys | Management SDK, user import, SSO/SCIM |
| (OIDC library kept) client ID and secret | Console → Applications → the Federated OIDC App (Confidential) | A server-side app's OIDC client configuration; Public apps (SPA, mobile) use the Client ID only, with PKCE |
Before migrating any app-built screen that calls the FusionAuth Management API, or any link to
FusionAuth's /account pages, ask whether a Descope Widget or the SSO Setup Suite covers the use
case. See references/flows-and-widgets.md → Mapping FusionAuth's Self-Service and Admin Surfaces.
Enumerate the project's actual widgets before referencing any widgetId in code. Not every
widget is provisioned by default in a fresh project, and the SDK exports and types every widget
component regardless — so a missing widget is invisible to TypeScript and shows up only at runtime.
See Step 4 → A widgetId with no widget behind it fails as an authorization error.
The Descope MCP server automates a real share of this checklist, but not all of it, and writes require explicit approval. Before manually clicking through the Console:
sign-up-or-in flow, a Tenant Admin role, and several default widgets. Use the read operations
first (listing flows, widgets, roles, permissions, users) so planned "create" steps don't duplicate
what already exists.After completing console setup: Update MIGRATION-STATE.md — check off each completed
item in the Console Setup Checklist, record the Project ID in the file, and set Next Action
to the first code change step.
FusionAuth apps fall into four integration families:
@fusionauth/react-sdk, @fusionauth/vue-sdk, @fusionauth/angular-sdk. They hold auth state, start the hosted login, and (by default) rely on a Hosted Backend that keeps tokens in app.* cookies.next-auth / Auth.js, openid-client, Passport, Spring Security, ASP.NET, authlib, go-oidc, AppAuth. Configured with FusionAuth's issuer, client ID, and secret.FusionAuthClient in TypeScript, Python, Go, Java, .NET, Ruby, PHP. Used for admin operations, and sometimes for login (client.login(...)) or token validation (validateJWT).AuthorizationManager), or AppAuth-based libraries.The recipes below map each to its Descope target.
The framework recipes below list the FusionAuth idioms that need mapping. Confirm the exact Descope SDK calls via the Descope MCP or local type declarations before generating any code. Do not ship code from these lists without verification.
Read references/implementation-nuances.md in two passes before writing any code:
offset to jump directly) — read only the section matching the user's stack.When a new framework is added to the file, add it to this list.
FusionAuthProvider / app.use(FusionAuthVuePlugin, …) / FusionAuthModule.forRoot() → Descope AuthProvider (or the framework's equivalent provider), configured with the Project ID instead of serverUrl + clientId + redirectUristartLogin() / FusionAuthLoginButton / <fa-login> → sdk.oidc.loginWithRedirect() with oidcConfig (hosted), or an embedded <Descope flowId> routestartRegister() / FusionAuthRegisterButton → the same Flow (sign-up-or-in), or a sign-up FlowstartLogout() / FusionAuthLogoutButton / navigation to /oauth2/logout → sdk.oidc.logout(...) (hosted) or sdk.logout() — see Step 4 → LogoutmanageAccount() / FusionAuthAccountButton / links to /account/ → User Profile Widget pageuseFusionAuth().isLoggedIn / RequireAuth / Unauthenticated / RequireAnonymous → useSession()'s isAuthenticated, with conditional renderingRequireAuth withRole="admin" → a role check against the Descope session (client-side gating only; always re-check on the server)useFusionAuth().userInfo / fetchUserInfo() / /app/me → useUser()refreshToken() / shouldAutoRefresh / /app/refresh → Descope SDK auto-refresh (remove the plumbing)useDpop / dpopFetch → normal fetch with the Descope session token in Authorization: Bearer, or rely on the DS cookie for same-site APIs/app/login, /app/callback, /app/refresh, /app/me, /app/logout, e.g. from fusionauth-javascript-sdk-express) → removedapp.at cookie or Authorization: Bearer + JWKS / HMAC verification → Descope validateSession() on the DS cookie (or Bearer token)claims.roles.includes(...) → the SDK's role validation helpers; aud checks → kept: point them at the aud a Federated OIDC App's tokens carry, or (Descope SDK session tokens) add aud via JWT Template and pass audience to validation; claims.applicationId reads → removed, or a JWT Template claimFusionAuthClient admin calls (createUser, register, updateRegistration, searchUsersByQuery, createGroupMembers, createIdentityProvider, …) → Descope Management SDK calls behind server endpoints, or a Widgetclient.login({ loginId, password, applicationId }) from a custom form → embedded Flow (recommended), or the Descope SDK's password sign-inFusionAuthClient with the API key. Audit each one: a Descope Management Key gets the same server-only treatment, and many of these routes are better replaced by a Widget acting as the logged-in user.Read the session the framework-native way — never hand-parse the JWT on the client. On front-end pages and components, get auth state from the Descope hooks:
useSession()for the session token and auth status,useUser()for the user profile, anduseDescope()for actions likelogout(). Do not manually decode the session token in client code. FusionAuth apps often read the JavaScript-visibleapp.idtcookie to show the user's name — that habit should not carry over. Server-side session validation belongs only in backend routes, middleware, and API handlers.
FusionAuth SDK: @fusionauth/react-sdk → Descope @descope/react-sdk
<FusionAuthProvider serverUrl clientId redirectUri scope shouldAutoRefresh shouldAutoFetchUserInfo> → <AuthProvider projectId> (add oidcConfig for hosted login)useFusionAuth() → useSession() (isAuthenticated, isSessionLoading, sessionToken) + useUser() (user, isUserLoading) + useDescope() (actions)startLogin() → useDescope().oidc.loginWithRedirect({ redirect_uri }), or route to an embedded <Descope flowId="sign-up-or-in" onSuccess>RequireAuth / Unauthenticated → conditional rendering on isAuthenticated; withRole → a role check helper over the sessionwithFusionAuth HOC → a small wrapper using the Descope hooksonRedirect(state) → handle the post-login destination in the Flow's onSuccess or after oidc callback handlinguseUser()/useSession() inline into a useEffect dependency array causes an infinite render loop. Depend on primitives, not the object.references/implementation-nuances.md → React.FusionAuth integration: next-auth (next-auth/providers/fusionauth) or the React SDK with nextCookieAdapter → Descope @descope/nextjs-sdk + @descope/node-sdk, or keep next-auth with Descope as the OIDC provider
Ask which way first — it is the biggest fork for Next.js:
next-auth (smallest change): replace the FusionAuth provider in [...nextauth] with a generic OIDC provider (or a Descope provider, if the installed Auth.js version ships one — check node_modules) pointed at https://api.descope.com/<ProjectID>, using a Confidential Federated OIDC App's own Client ID and Client Secret (not the Project ID, and not the legacy Access Key mode). getServerSession() / auth() / useSession() from next-auth stay. Update the jwt and session callbacks, which usually copy roles and tid off the FusionAuth token. Sessions still live in the next-auth cookie, not DS.@descope/nextjs-sdk: SessionProvider from next-auth/react → Descope AuthProvider (needs NEXT_PUBLIC_ Project ID); getServerSession(authOptions) / auth() → session() from @descope/nextjs-sdk/server; withAuth / middleware.ts from next-auth → Descope authMiddleware(options); signIn('fusionauth') → hosted login or an embedded Flow page; signOut() → Descope logout. Remove NEXTAUTH_SECRET / AUTH_SECRET and the [...nextauth] route./(api|trpc)(.*); an unauthenticated fetch() to a matched API route gets a 307 redirect to sign-in instead of a 401. Let route handlers validate session() and return their own 401.session() from @descope/nextjs-sdk/server is server-only; useSession()/useUser() from @descope/nextjs-sdk/client are client-only.session() and redirect.references/implementation-nuances.md → Next.js.FusionAuth SDK: @fusionauth/vue-sdk → Descope @descope/vue-sdk
app.use(FusionAuthVuePlugin, config) / createFusionAuth(config) → Descope Vue plugin with projectIduseFusionAuth() (isLoggedIn, userInfo, startLogin, startLogout) → Descope Vue composables for session and userRequireAuth (:with-role) / RequireAnonymous → v-if on the Descope session state, plus a role checknuxtUseCookie) → verify Descope's current Nuxt guidance via the MCP@fusionauth/vue-sdk/dist/style.cssFusionAuth SDK: @fusionauth/angular-sdk → Descope @descope/angular-sdk
FusionAuthModule.forRoot({...}) → Descope Angular module/provider with the Project IDFusionAuthService (isLoggedIn(), getUserInfoObservable(), startLogin(), logout()) → Descope Angular SDK session/user services<fa-login> / <fa-logout> / <fa-register> → Descope login (hosted or the Flow component) and logoutFusionAuth: oidc-client-ts, @auth0/auth0-spa-js-style PKCE helpers, or hand-rolled PKCE → Descope @descope/web-js-sdk + @descope/web-component, or keep the OIDC client pointed at Descope
authority, client_id, and scopes; verify the Descope issuer and discovery URL via the MCP@descope/web-js-sdk (getSessionToken(), refresh(), logout()) with <descope-wc project-id flow-id> for loginFusionAuth: @fusionauth/typescript-client, jose / jsonwebtoken against FusionAuth JWKS, Passport/openid-client → Descope @descope/node-sdk
jwtVerify(token, createRemoteJWKSet(...)), jwt.verify(token, secret), client.validateJWT(token)) → descopeClient.validateSession(sessionToken) against the DS cookie or Bearer token; parse the cookie yourself in Expresspayload.roles → descopeClient.validateRoles(authInfo, [...]) (or the tenant variant); confirm any-of vs. all-of semantics — FusionAuth SDK's withRole is any-ofnew FusionAuthClient(apiKey, url) admin calls → DescopeClient({ projectId, managementKey }) + management.user.*, management.tenant.*, management.role.*OIDCStrategy / openid-client → keep and repoint at Descope, or replace with the Descope SDKfusionauth-javascript-sdk-express) → deleteFusionAuth: fusionauth-client (FusionAuthClient), authlib / PyJWT → Descope descope Python SDK
PyJWT / authlib JWKS validation → descope_client.validate_session(session_token=...) in a Flask decorator, FastAPI dependency, or Django middlewareFusionAuthClient(api_key, url) → DescopeClient(project_id=..., management_key=...) + descope_client.mgmt.user.*authlib OAuth client registered against FusionAuth → keep and repoint, or replaceFusionAuth: github.com/FusionAuth/go-client/pkg/fusionauth, go-oidc / golang-jwt → Descope github.com/descope/go-sdk
fusionauth.NewClient(httpClient, baseURL, apiKey) → client.NewWithConfig(&client.Config{ProjectID: ..., ManagementKey: ...})go-oidc verifier / golang-jwt parsing → descopeClient.Auth.ValidateSessionWithToken(ctx, token), which returns (bool, *descope.Token, error)FusionAuth: io.fusionauth:fusionauth-java-client, Spring Security OAuth2 → Descope descope-java, or Spring Security pointed at Descope
spring.security.oauth2.client.provider.fusionauth.issuer-uri and/or spring.security.oauth2.resourceserver.jwt.issuer-uri. Keeping Spring Security is a config change: point issuer-uri at Descope, update the client registration to a Confidential Federated OIDC App (its own Client ID and Client Secret), keep any audience validator pointed at the aud the Federated App's tokens carry, and change the role mapping (Spring's JwtGrantedAuthoritiesConverter reading roles; Descope nests tenant roles under tenants)authenticationService.validateSessionWithToken(sessionToken) from descope-javaio.fusionauth.client.FusionAuthClient admin calls → Descope Java management servicesFusionAuth: FusionAuth.Client, ASP.NET AddOpenIdConnect / AddJwtBearer → Descope descope-dotnet, or ASP.NET pointed at Descope
options.Authority = "https://auth.example.com" (FusionAuth) with options.Audience = "<application id>" → Descope's issuer, with a Confidential Federated OIDC App's own Client ID and Client Secret for AddOpenIdConnect. Keep Audience, pointed at the aud the Federated App's tokens carry (decode one to confirm; usually its Client ID). Drop it only if no other app shares the Descope projectRoleClaimType = "roles" → Descope's role claim shape (top-level for project roles, under tenants for tenant roles)FusionAuthSyncClient / FusionAuthClient admin calls → Descope .NET management APIsFusionAuth: fusionauth_client gem, fusionauth/fusionauth-client package, OmniAuth / League OAuth2 → Descope Ruby SDK, or keep the OAuth library pointed at Descope
FusionAuth: fusionauth-swift-sdk (AuthorizationManager) or AppAuth-iOS → Descope descope-swift
AuthorizationManager.instance.initialize(...) and its login/logout/refresh calls → Descope Swift SDK flows and session APIsFusionAuth: io.fusionauth:fusionauth-android-sdk (AuthorizationManager.initialize(AuthorizationConfiguration(...))) or AppAuth-Android → Descope descope-kotlin
AuthorizationManager login/logout/fresh-token calls → Descope Kotlin SDK flows and session APIsFusionAuth: react-native-app-auth / flutter_appauth → Descope @descope/react-native-sdk / descope-flutter
After completing framework code changes: Update MIGRATION-STATE.md — mark each
modified file as Done in the Files Inventory, update Current Phase and Next Action, and
log any non-obvious decisions made.
Scan for FusionAuth references in non-code files after updating source files.
.env.example / .env.template / .env.sample# REMOVE (names vary by app — use what search 5 found)
FUSIONAUTH_URL=
FUSIONAUTH_ISSUER=
FUSIONAUTH_CLIENT_ID=
FUSIONAUTH_CLIENT_SECRET=
FUSIONAUTH_API_KEY=
FUSIONAUTH_TENANT_ID=
FUSIONAUTH_REDIRECT_URI=
AUTH_FUSIONAUTH_ID=
AUTH_FUSIONAUTH_SECRET=
AUTH_FUSIONAUTH_ISSUER=
# ADD
DESCOPE_PROJECT_ID= # Console → Project Settings
NEXT_PUBLIC_DESCOPE_PROJECT_ID= # Next.js / frontend — same value as above
DESCOPE_MANAGEMENT_KEY= # Console → Company Settings → Management Keys (replaces FUSIONAUTH_API_KEY for admin APIs)
Run grep -ri "FUSIONAUTH" to find all env var references — .env.example, Docker, CI, shell
scripts, Helm values, appsettings*.json, application.yml.
Search all .md files for FusionAuth references. At minimum, update:
docker-compose.yml: remove the fusionauth service (fusionauth/fusionauth-app), its database
and search containers if they existed only for FusionAuth, and the kickstart volume — after
the export is complete and FusionAuth is no longer needed for JIT.github/workflows/ and other CI: remove FusionAuth service containers used by integration tests,
and replace them with a Descope test project or mocked session validationkickstart.json and FusionAuth Terraform (FusionAuth/fusionauth provider) describe the
configuration being migrated. Use them as the inventory for Console setup, then retire them. If the
team wants configuration as code going forward, the
Descope Terraform provider is the
replacement (see the descope-terraform skill). Leaving FusionAuth Terraform in place means the next
terraform apply recreates what the migration retired.
.ftl FreeMarker templates in the repo (exported themes, email templates) are not code to port. Use
them as the visual and copy reference for Descope Flow screens, Styles, and Messaging Templates, then
delete them.
fusionauth config resourcesWhen the migration includes a setup or seed script, split it into two parts:
MIGRATION-PLAN.md.management.role.create()), tenant creation, access key provisioning, SSO/SCIM config. Preserve these as a script using the Descope Management SDK, or as Terraform.After completing non-code file updates: Update MIGRATION-STATE.md — mark env files,
README, CI config, and infrastructure files done in the Files Inventory, and advance Next Action.
For each FusionAuth feature confirmed in triage, write a short paragraph: what it accomplishes, the best Descope approach for that goal, what's different, and what action is required. Reason about intent, not just the API surface — the best approach may be a Flow, Widget, SSO Setup Suite, Inbound App, Console configuration, or tenant configuration rather than a direct SDK equivalent. Only recommend SDK/API code when programmatic control is genuinely required, and verify every method name against the Descope MCP server before writing it. Include only confirmed features.
This is usually the first thing to settle, because it drives the cutover plan. Write the migration script for the user's setup rather than handing them a generic tool. Descope's descope-migration repo has no FusionAuth module; its other providers are a reference for request shapes only. There is no FusionAuth page in Descope's migration docs at the time of writing — check before linking to one. Never tell the user to open a guide you have not confirmed exists. The Descope custom migration guide documents the import format, including password hashes.
Path 1 — Full migration with password hashes (recommended default). Export from the FusionAuth
database (self-hosted) or a support-provided database export (Cloud), and create the matching objects
in Descope in dependency order: tenants → permissions → roles → users. Users carry their hash in
hashedPassword, so they keep their password. Things the script must get right:
identities table (current schema), joined to users, per user — each row has its own encryption_scheme, factor, salt, and password.references/implementation-nuances.md → Password hash mapping). Skip hashedPassword for schemes with no Descope equivalent and set freshlyMigrated instead.user_registrations + user_registrations_application_roles) plus roles granted through groups (group_members + group_application_roles) — group roles count only for Applications the user is registered for.active status, and none is locked or blocked by a user action, giving the merged user one membership per tenant. Record every source (tenantId, fusionauthUserId) pair for the merged user so reconciliation can track each membership. Write unverified or conflicting duplicates to a manual-resolution list instead of importing them (Step 4 → Email Uniqueness Across Tenants).active = false) users, and users with an unexpired login-blocking user action, as disabled; skip phone numbers that aren't E.164; set verifiedEmail from FusionAuth's verified flag.seed (base32) for users with an authenticator method, once the export's secret encoding is confirmed.createdTime to preserve insert_instant where the batch endpoint supports it.Path 2 — JIT migration with a Generic HTTP Connector. For users whose hashes didn't import, or
when the export is delayed, or as the whole strategy if the team prefers. The Descope Flow collects
email and password, a
Generic HTTP Connector
calls FusionAuth's Login API (POST {FUSIONAUTH_URL}/api/login with loginId, password, and
applicationId, authenticated with an API key limited to that endpoint), and on success the Flow
creates or updates the Descope user and stores the password. The plaintext password goes over this
call, so FUSIONAUTH_URL must be https://.
The connector fails closed: 200 is the only success. Several other codes mean the password was correct but FusionAuth refused the sign-in on purpose. Once the Flow stores a password, the refusal is gone for good, so never treat those codes as success:
| FusionAuth response | Flow branch |
|---|---|
| 200 | Success: store the password and issue the Descope session |
| 202 (not registered for the application) | Deny |
| 203 (password change required) | Password reset branch; don't store the old password |
| 212 (email not verified), 213 (registration not verified) | Verification step (OTP or magic link) before storing the password or issuing a session |
| 242 (two-factor required) | Only proceed after the user proves the factor enrolled in FusionAuth: verify the TOTP seed imported from FusionAuth, or complete FusionAuth's challenge (POST /api/two-factor/login with the returned twoFactorId) and get a 200. Never let the user enroll a new factor in this branch. Otherwise deny, or send these users through Path 3, where FusionAuth's hosted login runs the MFA |
| 404 (unknown user or wrong password), 409, 410, 423, any other code, timeouts, 5xx | Deny |
For users already imported (freshlyMigrated), the Flow signs them in with OTP or magic link and
stores the password with Update Password (not Sign Up / Password), then clears the flag.
Path 3 — JIT migration with FusionAuth as a custom OIDC provider. Configure FusionAuth as a custom OAuth/OIDC provider in Descope using a FusionAuth Application's client ID, secret, and the tenant's discovery endpoints, then add an OAuth sign-in step to the Flow. Users authenticate through FusionAuth's hosted login — MFA included — and Descope provisions them from the returned ID token claims. Add a Flow condition that routes already-provisioned users to Descope-native auth.
Both JIT paths keep FusionAuth running for a transition period the user chooses (recommend at least a few months when passwords matter), and both require dual token validation in the backend if FusionAuth sessions must keep working during the transition (see Step 4).
The API side of the export (tenants, applications and their roles, groups, identity providers,
lambdas, webhooks) goes through the Management API with the raw API key in Authorization (no
Bearer) and X-FusionAuth-TenantId where needed. User profiles can also come from
POST /api/user/search, but hashes cannot, so for most migrations the database is the single source
for users. Import with POST /v1/mgmt/user/create/batch. See
references/implementation-nuances.md → Migrating users and tenants for the queries, endpoints,
field mapping, and data-quality checks.
Effort: Low–Medium for a single-tenant hash import on a clean data set; Medium–High with multi-tenant merges, mixed schemes, or JIT, which adds Flow engineering and a transition period.
A FusionAuth tenant is an isolated user pool with its own issuer, keys, password and MFA policy, email settings, and themes. Decide what each one becomes before anything else:
| FusionAuth tenant used as | Descope | What moves with it |
|---|---|---|
| An environment | Project | Everything; repeat Console setup per project |
| A B2B customer | Tenant | Name, custom attributes, SSO, email domains; tenant-level password and session settings; per-tenant MFA becomes a Flow condition on a tenant attribute |
| A separate product/brand | Project | Everything; users don't overlap |
For B2B tenants, compare what FusionAuth let each tenant customize with what a Descope tenant supports. Per-tenant themes and email templates become Flow conditions or separate Flows keyed on the tenant; per-tenant issuer and signing keys have no equivalent (one project, one issuer); per-tenant connectors and identity providers become tenant SSO configuration.
The request-time difference: FusionAuth puts the tenant ID in the tid claim and the token is only
ever for one tenant. Descope exposes the active tenant as dct and all memberships under tenants.
Prefer SDK helpers such as validateTenantRoles(...) over reading claims by hand.
Effort: Low when tenants are environments; Medium–High when they are customers, because of the merge rule and per-tenant settings.
A FusionAuth Application is an OAuth client: it has a client ID (the Application ID), a secret,
redirect URLs, enabled grants, its own roles, and optionally its own login theme, MFA policy, and
JWT settings. The aud and applicationId claims identify it.
| What the Applications represent | Descope approach |
|---|---|
| One app (the common case) | The Descope Project itself; nothing to create |
| Several surfaces of one product sharing users (web, admin, mobile) | One project; a role or custom attribute for any per-surface access rule; Federated Apps for those that keep a generic OIDC client |
| Separate products with separate users | Separate Projects |
| Third-party or partner clients needing scoped API access | Inbound Apps + Resources |
| Applications used only for client credentials | See Entities and M2M |
Registrations are the part that needs a decision. In FusionAuth a user can exist without being
registered for an Application, and FusionAuth then authenticates them without authorizing them (the
Login API returns 202, the token has no roles). If the app relies on that — "only users registered
for the admin app may sign in to it" — model it as a role (admin-app-user), a tenant, or a Flow
condition that denies sign-in without it. If every user is registered for the one Application, there
is nothing to model.
Effort: Low for one Application; Medium for several, mostly in the decision.
| FusionAuth | Descope |
|---|---|
Application role (name, isDefault, isSuperRole) | Role (referenced by name) |
| Same role name in two Applications | Merge, or prefix (billing:admin) — Descope role names are project-wide |
| Default role on registration | Flow step assigning the role on sign-up, or tenant default roles |
| Registration roles | Project-level roles (single tenant) or tenant roles (B2B) |
| Group with application roles | Roles assigned to the user directly (flatten at import) |
| Group membership read by the app or put in the token by a lambda | Roles, or a custom attribute holding group names |
roles claim | roles (project-level) or tenants.<id>.roles |
| Fine-grained permissions | FusionAuth has none on roles (Entity Types have permissions — see Entities); create Descope permissions only if wanted |
FusionAuth groups have one more behavior to preserve: group roles apply only to Applications the user is registered for. Flatten with that rule, not by giving every member every group role.
Effort: Low–Medium.
| FusionAuth | Descope |
|---|---|
Hosted login page (/oauth2/authorize) | Descope-hosted login (oidcConfig) or embedded Flow |
| Theme (FreeMarker templates + CSS) | Flow Screens + Styles |
| Simple theme editor | Styles |
| Basic self-service registration | Sign-up Flow |
| Advanced Registration Forms (multi-step, custom fields) | Flow Screens + custom attributes |
| Password, magic link (passwordless), passkeys | Passwords, Magic Link / OTP, Passkeys |
| Social IdPs | Descope OAuth providers (custom OAuth for any Descope lacks) |
Localization (messages properties per locale) | Flow localization |
| Email templates (FreeMarker) | Messaging Templates |
Custom login form on /api/login | Embedded Flow (recommended), or SDK password methods / BYOS |
Two notes. First, a heavily customized FreeMarker theme can be matched closely with Styles, but if
the brand requires pixel-level control, Descope's Bring Your Own Screen (BYOS) lets the app render its
own components while the Flow runs the logic. Second, check the tenant's login identifier setting:
if users sign in with a username, the Descope loginId must be the username (email can be stored
alongside).
Effort: Low–Medium, higher with Advanced Registration Forms or a theme the brand team cares about.
Lambdas are FusionAuth's extension point. Read each lambda's source (GET /api/lambda) before
mapping it — the type says when it runs, the body says what it does.
| FusionAuth lambda | Descope approach |
|---|---|
| JWT populate / Id Token populate / UserInfo populate | JWT Template claims, or a Flow custom-claims action |
| Client credentials JWT populate | JWT Template on the M2M token / Inbound App |
| OIDC / SAML v2 reconcile | SSO attribute mapping and group-to-role mapping on the tenant; Flow step after SSO for anything else |
| Social provider reconcile (Google, Apple, Facebook, …) | OAuth provider attribute mapping; Flow step for anything else |
| External JWT / LDAP connector reconcile | Generic HTTP Connector step |
| Login validation (Enterprise) | Condition or Connector after authentication, with a deny branch |
| MFA requirement | Flow condition deciding whether the MFA step runs |
| Self-service registration validation | Scriptlet or Connector + Condition before user creation |
| SAML v2 response populate (FusionAuth as SAML IdP) | Federated SAML App attribute mapping |
| SCIM request/response converters | Descope SCIM mapping — confirm coverage per attribute |
Three things to pin down for each lambda: whether it rejects (that's a security control), whether it calls out over HTTP (that becomes a Connector with a timeout and fail behavior), and which claims or user fields it writes (each must reappear in a JWT Template or a custom attribute).
Effort: Low for populate lambdas that copy fields; Medium–High for validation lambdas.
| FusionAuth | Descope |
|---|---|
| OpenID Connect IdP (enterprise) | Tenant OIDC SSO |
| SAML v2 IdP | Tenant SAML SSO |
| Managed domains on an IdP | Tenant email domains (SSO routing) |
idp_hint | Tenant-based SSO routing or ssoId-style hints in the SDK — verify the current option |
| Tenant restrictions on an IdP | Tenant SSO configuration |
| IdP-initiated SAML | Descope IdP-initiated SSO — confirm support per tenant |
| Social IdPs (Google, Apple, Facebook, Microsoft, LinkedIn, Twitter, GitHub via OIDC) | OAuth providers |
| Gaming IdPs (Steam, Twitch, Xbox, Epic, Nintendo, Sony PSN), HYPR | Check Descope's provider list; custom OAuth provider otherwise; flag any with no OAuth/OIDC path |
| Identity provider links (user ↔ external ID) | Descope links on first SSO sign-in by email; confirm matching rules |
| FusionAuth as SAML v2 IdP / OIDC provider for other apps | Federated Apps — separate workstream |
| Customer-managed IdP setup (Tenant Manager or app screens) | SSO Setup Suite |
Existing SAML/OIDC connections can be moved without making every customer admin reconfigure their IdP. Follow SSO migration for the tenant setup, redirect, and testing sequence.
Effort: Medium — higher if FusionAuth is also an IdP for downstream apps.
FusionAuth's SCIM server (Enterprise) accepts users and groups from customer directories through client-credentials-authenticated endpoints, shaped by SCIM converter lambdas. Treat it as a continuing pipeline, not a one-time import. Each customer directory must get Descope's SCIM endpoint and token for its tenant before cutover, and group-to-role mapping must reproduce what the converter lambdas and group roles did.
Effort: Medium–High.
FusionAuth's Entity Management models machines: Entity Types define permissions, Entities are clients with a client ID and secret, and Grants give one entity permissions on another. Services use the client credentials grant to get a token whose scopes reflect those grants.
| FusionAuth | Descope |
|---|---|
| Entity (client ID + secret) calling an API | Confidential Inbound App with a Policy granting client_credentials access to a Resource's scopes |
| Entity Type permissions | Resource scopes |
| Grant (entity → entity, with permissions) | Policy granting scopes; or FGA relations if grants model data-level authorization |
| Simple internal service auth | Access Keys |
| User-to-entity grants (users granted access to things) | FGA relations — use the descope-fga-schema skill |
| API keys given to services for the Management API | Descope Management Keys (server-only) |
Inventory every client, the permissions it holds, and the audience downstream services check. Secrets don't transfer; plan a rotation window. Effort: Medium.
FusionAuth webhooks deliver events (user.create, user.login.success, user.registration.create,
group.member.add, jwt.refresh, …) signed with a JWT in X-FusionAuth-Signature-JWT. Some are
transactional: FusionAuth waits for a 2xx and fails the action if the webhook fails.
| FusionAuth | Descope |
|---|---|
| Non-transactional webhook keeping an app DB in sync | Audit Webhook / Connector on the matching audit events |
| Transactional webhook that can block an action | Flow step (Connector + Condition) in the Flow that performs the action |
user.registration.* events | Role / tenant assignment events, or app-side sync |
Signature verification (X-FusionAuth-Signature-JWT) | Descope webhook signature validation — rewrite the verifier |
Identify which handlers are business-critical before cutover. Effort: Medium.
| FusionAuth | Descope |
|---|---|
| TOTP authenticator | TOTP in the Flow; seeds can be imported (seed, base32) |
| Email / SMS MFA | OTP steps in the Flow; users re-enroll their phone if it wasn't a verified phone |
| Recovery codes | Descope recovery options — recovery codes don't transfer |
| Tenant / application MFA policy | Flow conditions (on tenant attributes or the starting app) |
| WebAuthn / passkeys | Descope Passkeys — do not transfer; users re-enroll |
| Breached password detection | Breached-password check in the password step (verify current option) |
| Advanced Threat Detection (rate limits, CAPTCHA, IP ACLs, impossible travel) | Connector steps (reCAPTCHA, Arkose, Fingerprint, AbuseIPDB) + Flow conditions |
| User actions (temporary lock, prevent login) | Disable/enable user via Management SDK; Flow condition on a custom attribute for timed locks |
| Password history, expiration, complexity | Descope password policy — confirm each setting |
Ask whether each security feature is monitoring-only or actually gates login. Effort: Medium when they gate production logins.
| FusionAuth | Descope |
|---|---|
| Access token (RS256/ES256, or HS256 on Kickstart/older installs) | Descope session JWT (DS cookie), verified via JWKS |
Refresh token (offline_access; sliding / one-time-use policies) | DSR refresh cookie; confirm rotation behavior |
Hosted Backend cookies app.at, app.rt, app.idt, app.at_exp | DS / DSR, managed by the SDK |
next-auth session cookie | Stays (if next-auth is kept) or replaced by DS/DSR |
| DPoP-bound tokens | Bearer session tokens (DPoP not part of the default Descope SDK flow) |
| Access / refresh token lifetimes (tenant, overridable per application) | Project session/refresh token lifetimes |
aud = Application ID | Descope SDK session tokens: no aud by default, configure via JWT Template if validated. Federated OIDC App tokens: carry an aud already (see Audience Validation Is Opt-In) |
tid, applicationId, authenticationType, sid claims | Not present by default — add via JWT Template only if the app reads them |
JWKS at /.well-known/jwks.json | Descope JWKS endpoint |
Effort: Medium — token differences ripple through middleware, API routes, and frontend.
If a Generic or LDAP Connector is still pulling users into FusionAuth from a legacy system, some users have never signed in to FusionAuth and have no FusionAuth password. Establish which: connector-migrated users (FusionAuth holds a hash), connector-authenticated-every-time users (the legacy system holds the credential), and users still only in the legacy system. Then either finish that migration first, or point a Descope Generic HTTP Connector at the same legacy endpoint so Descope takes over the role FusionAuth was playing. Effort: High — flag for dedicated review.
FusionAuth Consents (with consent status per user, often COPPA-related) and Families (parent/child accounts) have no Descope object. Store consent state in custom attributes (with a Flow screen to collect it) and family relationships in the application database or FGA relations. Get an explicit decision; these often carry legal requirements. Effort: Medium.
This list is used twice: during Step 0 / Step 0.5 triage, to decide what to flag before the plan is written, and again here, to sanity-check that nothing high-complexity slipped through the feature mapping. The main high-complexity FusionAuth areas are:
FusionAuth's access token carries sub, iss, aud (the Application ID), applicationId, roles,
tid, email, email_verified, preferred_username, authenticationType, auth_time, sid,
jti, scope, gty, tty, plus anything a JWT populate lambda adds. Descope session JWTs always
carry sub, iss, iat, exp, drn, and amr. The rest are conditional:
tenants — present when the user has tenant associations and the JWT template uses the default authorization format.dct — auto-set when the user belongs to exactly one tenant, or after tenant selection in a Flow.roles / permissions — can be project-level, in which case they appear with no tenant association at all.Descope tokens carry no email, name, or preferred_username, and sub is the Descope user ID,
not the FusionAuth UUID. Any code that joins on sub to an application table keyed by the FusionAuth
user ID needs the fusionauthId custom attribute (in the token via JWT Template, or looked up
server-side) or a migration of those foreign keys.
Action required: Configure a JWT Template to add email and any other fields the app reads —
including everything JWT populate lambdas used to inject.
sub ChangesFusionAuth user IDs are UUIDs and appear as sub. Descope assigns its own user IDs. Grep for every
place the app stores or compares the token's sub (orders, audit rows, ownership checks). Either keep
fusionauthId as a custom attribute and expose it as a claim during a transition, or migrate those
references to the Descope user ID. This is the most common silent data bug after cutover.
FusionAuth emails are unique per tenant; Descope login IDs are unique per project. When FusionAuth
tenants become Descope tenants, [email protected] in tenants A and B becomes one Descope user with two
memberships — but she had two passwords, two profiles, and maybe two MFA setups.
A merge can hand one person's account to another. FusionAuth tenants are separate user pools, so
anyone may have registered [email protected] in tenant B without proving they own that address. If an
unverified record in B wins the merge, its password, MFA, and roles become Jane's merged identity, and
whoever created it can take over her account. Use this rule:
verified = true, the same active status, and no
lock or login-blocking user action.
Then pick the password, profile, and TOTP seed from one record (most recent last_login_instant is
the usual default), and give the merged user one membership per tenant, each with that tenant's
roles.active or lock status, don't import that email automatically. Write it to a review list for the
team to resolve. A Descope user's disabled status covers the whole project, so it can't express
"inactive in tenant A, active in tenant B". The resolution is either to leave the inactive tenant's
membership off or to disable the user, and a person makes that call.Count duplicates, and how many fall into each bucket, before planning. Tell affected users which password still works.
Kickstart and pre-1.50 FusionAuth installs sign tokens with HMAC (HS256), and HMAC keys are never in
JWKS, so backends verify with a shared secret. Others paste an RSA public key from the admin UI. Both
produce valid-looking code that rejects every Descope token. Grep for HS256, jwt.verify(token, <secret>), and inlined PEM keys; replace with Descope session validation.
DS and DSRThe FusionAuth SDKs' Hosted Backend stores app.at (access token, HttpOnly), app.rt (refresh
token, HttpOnly), app.idt (ID token, JS-readable), and app.at_exp (expiry, JS-readable). Code that
reads app.at on the server, app.idt in the browser, or app.at_exp to schedule refresh must be
replaced. The Descope SDK manages DS (session) and DSR (refresh).
descopeClient.logout(refreshToken) (or the client SDK's logout()) to invalidate server-sideDS and DSR cookiesSkipping either step leaves a broken state. FusionAuth logout was usually a navigation to
/app/logout/{client_id} or /oauth2/logout?client_id=…&post_logout_redirect_uri=…, often a plain
link, so a grep for logout() misses it. With Descope-hosted login, use sdk.oidc.logout({ post_logout_redirect_uri }).
FusionAuth tokens carry aud = the Application ID, and backends — especially ASP.NET with
options.Audience, Spring with an audience validator, and jose with audience — often check it.
Keep that check. What it validates against depends on which Descope token the backend receives:
aud claim by
default. Configure a custom aud claim in a JWT Template and pass audience to
validateSession().aud — the project
ID, the client ID, or the app ID, per the Descope docs. Decode one token from the new app to confirm
the value, and point the existing validator at it, usually the Federated App's Client ID.Don't remove an audience validator unless you've confirmed no other application shares the Descope project. Otherwise the backend accepts tokens issued for those apps. Without one of the two fixes, validation either fails or silently stops checking something it used to check.
Unless the cutover is a hard big-bang switch, some users will hold Descope tokens and others
FusionAuth tokens for a while. The backend must validate both: inspect the issuer or kid to pick
the verifier, then verify the signature against that provider's keys and pin the issuer (and audience
where used) before any claim is trusted. For an HS256 FusionAuth install, the FusionAuth branch
verifies with the shared secret; route on iss, never on alg. See
Descope session migration — currently beta,
documented for Auth0, Okta, or a custom-built solution; confirm it still applies before leaning on it,
and fall back to hand-rolled dual validation otherwise. Plan the removal of the FusionAuth branch as an
explicit follow-up task — dual validation left in place becomes a permanent second attack surface.
tid Becomes dct / tenantsMost code passing a FusionAuth tenant ID is management code (X-FusionAuth-TenantId, tenantId on
API calls) — it becomes a Descope tenant ID passed to management.* calls, or disappears if tenants
became projects. Request-time code that read tid reads dct (active tenant) or tenants
(memberships). Sort every hit into these buckets before updating.
On the web client, check null-handling before using claim helpers. @descope/web-js-sdk's
getTenants(), getJwtRoles(), and getCurrentTenant() read the tenants claim without guarding
against it being absent — a user with no tenant has no tenants claim, and getTenants() throws.
Prefer useUser().userTenants for display, or guard (Object.keys(claims?.tenants ?? {})).
FusionAuth role changes on a registration appear only in the next token (after refresh or re-login).
Descope behaves the same way — tenants, roles, permissions, and dct are set when the token
is issued. During migration testing, roles assigned in the Console to an already-signed-in user won't
show up until a new token. For display, prefer useUser() (fetched live); for authorization, repair
the token (refresh, or selectTenant() for dct) rather than working around it in the UI.
widgetId With No Widget Behind It Fails as an Authorization ErrorEvery Widget referenced in code must correspond to a widget actually provisioned in the Console for that project — referencing one that isn't fails at runtime with "Unauthorized user: Operation not allowed for management request," which reads like an RBAC problem. If a widget call fails with that error, check whether the widget exists before touching permissions. TypeScript gives no warning.
Outside Next.js — which ships authMiddleware in @descope/nextjs-sdk/server — Descope has no
drop-in auth-middleware package. Hand-written FusionAuth JWKS middleware, Passport strategies, and
resource-server configs become roughly 20 lines of custom code that reads the DS cookie (or Bearer
token) and calls validateSession() — unless the team keeps a standards-based resource server and
repoints it at Descope's issuer.
cookies() and headers() Are Async in Next.js 15cookies() and headers() from next/headers return a Promise in Next.js 15+. Check the version;
if ≥ 15, await cookies() and mark the containing function async, then trace callers.
In TypeScript, marking a shared session helper async silently breaks every caller that omits
await. Grep for all call sites in the same pass; the cascade routinely spans 10–20 files.
FusionAuth Applications register full "Authorized redirect URLs" (and optionally wildcards) and
"Authorized request origin URLs". Descope uses Approved Domains — domain only, no protocol, no
path. For local dev: localhost:3000, not http://localhost:3000/app/callback. A kept OIDC
library registers its callback on the Descope Federated App instead.
Imported hashes are accepted as-is, but if the Descope password policy is stricter than the FusionAuth tenant's, users who later change their password (or JIT users whose password is stored on first sign-in) hit validation errors. Set the Descope policy to match FusionAuth's at cutover; tighten later.
On the Elasticsearch search engine before FusionAuth 1.48.0, POST /api/user/search returns at most
10,000 users regardless of paging. From 1.48.0, use the nextResults token. The database search
engine pages with startRow / numberOfResults. Export from the database when you need hashes
anyway, and compare the exported count against SELECT COUNT(*) before importing.
The export contains password hashes and MFA secrets. Keep it encrypted at rest, out of the repo and out of chat, run the import from a trusted machine, and delete it (and any intermediate JSON) after the production import is verified.
If FusionAuth's SCIM server is in use, re-point every customer directory at Descope before cutover. Interactive login keeps working while provisioning silently stops — the failure shows up days later.
Passkeys are bound to the relying party (FusionAuth's domain), so they cannot move. Email and SMS MFA
re-enroll naturally if the email/phone is verified. TOTP can move via the seed field if the secret is
in the export. Communicate re-enrollment before the cutover date, not after.
Run the app and verify it works — don't just hand over a checklist.
grep -rni "fusionauth\|app\.at\b\|app\.rt\b\|app\.idt\|/oauth2/\|/app/callback" \
--include="*.ts" --include="*.tsx" --include="*.js" --include="*.jsx" --include="*.vue" \
--include="*.py" --include="*.go" --include="*.rb" --include="*.php" --include="*.java" --include="*.kt" \
--include="*.cs" --include="*.swift" --include="*.dart" --include="*.gradle" \
--include="*.plist" --include="*.xml" --include="*.env*" --include="*.yml" --include="*.yaml" \
--include="*.properties" --include="appsettings*.json" --include="*.json" \
--exclude-dir=node_modules --exclude-dir=.next --exclude-dir=dist --exclude-dir=Pods \
.
Triage the hits — don't treat every match as a failure. Imports, package names, env vars, config
files, CI workflows, Docker services, and issuer URLs referencing FusionAuth must be zero (except
infrastructure deliberately kept for the JIT transition, recorded in the Decisions Log). Comments
explaining what a construct used to be are expected and should stay. /oauth2/ hits can be
legitimate if a kept OIDC library now points at Descope — read each one. Pay particular attention to
non-source files — .env*, CI workflows, docker-compose.yml, application.yml,
appsettings.json — since none of these break compilation and are the most commonly missed.
npm install # or: pip install -r requirements.txt / go mod tidy / bundle / composer install
npx tsc --noEmit # TypeScript
go build ./... # Go
mvn compile -q # Java/Maven
./gradlew compileJava compileKotlin # Java/Gradle
dotnet build # .NET
Do not proceed until compilation exits with zero errors.
If compilation fails, diagnose by error message:
Cannot find module '@fusionauth/...' → stale import; re-run Phase 0Property 'roles' does not exist on type '...' → wrapper built against FusionAuth's flat claims; re-derive from the Descope authInfo shape'await' expression is not allowed in synchronous contexts → async cascade gapObject is possibly 'undefined' on session fields → add null check or early returnnpm run dev # or: python main.py / go run . / flask run / etc.
npm test # or: pytest / go test ./... / etc.
Auth-related test failures usually mean: a fixture still mints FusionAuth-shaped tokens (with
applicationId, tid, aud); a test asserts on email without a JWT Template; a test still spins
up a FusionAuth container; or a mock still stubs FusionAuthClient.
# Root path
curl -s -o /dev/null -w "%{http_code}" http://localhost:<port>/
# Unauthenticated protected route (expect 3xx or 401)
curl -s -o /dev/null -w "%{http_code}" http://localhost:<port>/dashboard
# Login page loads Descope component (embedded Flow) or redirects to Descope (hosted)
curl -s -i http://localhost:<port>/login | grep -i "descope"
# Invalid token → 401
curl -s -H "Cookie: DS=invalid_token" http://localhost:<port>/api/me
# No FusionAuth endpoints are still being called
curl -s http://localhost:<port>/ | grep -i "fusionauth\|:9011" && echo "STALE FUSIONAUTH REFERENCE"
echo "<DS_cookie_value>" | cut -d'.' -f2 | base64 -d 2>/dev/null | python3 -m json.tool
Check that email and any other expected claims are present, that roles match what the user had in
FusionAuth, and that dct / tenants hold the tenant context the app used to read from tid.
## Test Results
**Server startup:** ✅ Started successfully on port 3000
**Existing tests:** ✅ 12 passed / ❌ 2 failed (list failures)
**Unauthenticated /dashboard:** ✅ 302 → /login
**Unauthenticated /api/protected:** ✅ 401
**Login page loads Descope:** ✅
**Imported-user password sign-in:** ✅ pbkdf2-sha256 / ✅ bcrypt / ⚠️ salted-md5 → JIT path
**JWT claims (email, roles, dct):** ✅ Present / ❌ Missing — JWT Template not yet configured
**No residual FusionAuth references:** ✅
**Blockers before going live:**
- [ ] (list anything that failed or needs manual action)
Do not proceed to Step 6 until ALL of the following are true:
Every migration produces a MIGRATION-SUMMARY.md covering what was done, manual setup
remaining, and behavioral differences that matter before production.
sub change, cookies, logout, audience validation, role-change propagation, tenant merge results, users on unsupported hash schemes, MFA re-enrollment, and anything with no equivalent (registrations, families, consents, per-tenant issuers)Write a numbered migration guide in Markdown, scoped to the user's stack. Use code snippets and direct doc links. Always include the MIGRATION-SUMMARY.md deliverable (Step 6).
For complex migrations, flag the high-effort items explicitly with estimated complexity (Low/Medium/High) so the user can plan.
references/implementation-nuances.md — Verified migration patterns, export queries and endpoints, password hash mapping, framework recipes, and edge cases.references/flows-and-widgets.md — Descope terminology, Flows, Widgets, SSO Setup Suite, and the Console-vs-code decision guide.references/fusionauth-detection-patterns.md — Codebase search commands and common env vars.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub descope/skills --plugin descope-skills14 skills in this plugin
/auth0-to-descopeUse this skill whenever anyone asks about migrating from Auth0 to Descope — whether they're a developer doing it themselves or a technical lead evaluating the move. Triggers on: "how do I migrate from Auth0", "replace Auth0 with Descope", "we're moving off Auth0", "Auth0 to Descope", "switch from Auth0", "our app uses express-openid-connect / nextjs-auth0 / auth0-fastapi / other Auth0 SDK and we want to use Descope instead", or any question about Auth0 features (Actions, FGA, Organizations, Token Vault, CIBA) in the context of Descope. Works for any language or framework with a Descope SDK. Always use this skill before producing migration guidance — do not rely on memory alone.
/auth-reviewStatic security review for authentication and authorization vulnerabilities. Use when the user invokes /auth-review, asks to audit auth, find identity breaches, review access control, hunt for IDOR/BOLA, or check authorization. Framework- and vendor-agnostic. Enumerates every route/endpoint, builds an authorization matrix, applies a vulnerability catalog, and writes a triage report ready to turn into issues or PRs./azure-ad-b2c-to-descopeUse this skill whenever anyone asks about migrating from Azure AD B2C (Azure Active Directory B2C) to Descope — whether they're a developer doing it themselves or a technical lead evaluating the move. Triggers on: "migrate from Azure AD B2C", "replace Azure B2C with Descope", "we're moving off B2C", "B2C end of sale", "Azure AD B2C to Descope", "our app uses @azure/msal-browser / @azure/msal-react / @azure/msal-angular / @azure/msal-node / Microsoft.Identity.Web / passport-azure-ad with b2clogin.com and we want to use Descope instead", or any question about B2C features (user flows, custom policies / Identity Experience Framework, API connectors, b2c-extensions-app custom attributes, identity providers, ROPC, embedded sign-in, scp claim) in the context of Descope. Works for any language or framework with a Descope SDK. Always use this skill before producing migration guidance — do not rely on memory alone.
Other plugins' skills for the same job