/descope-skills:frontegg-to-descopefrom descope-skills
Guides migration from Frontegg to Descope, covering hosted/embedded login, multi-tenancy, RBAC, ReBAC, entitlements, SCIM, SSO, MFA, webhooks, and AI-agent identity. Produces a migration plan and executes it step by step.
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 Frontegg 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.
Frontegg is not only an authentication provider — it is a B2B SaaS identity platform spanning hosted and embedded login, multi-tenant Accounts, isolated Environments, multiple Applications per environment, a broad end-customer self-service portal, RBAC with role levels, ReBAC, an entitlements engine (features, plans, feature flags), security rules, step-up authentication, MFA, SCIM, enterprise SSO, prehooks, webhooks, no-code Flows, machine-to-machine tokens, user pools that federate an existing user store, and AI-agent identity with managed third-party OAuth. A good migration first identifies which Frontegg product surfaces are actually in use, then maps each one to the closest Descope feature or migration pattern. Expect Frontegg migrations to vary widely: two Frontegg apps can share the same SDK and have almost nothing else in common.
Primary references (both in this skill's directory):
references/implementation-nuances.md — verified migration patterns for each framework, Frontegg feature-to-Descope mappings, user export patterns, and known gotchasreferences/flows-and-widgets.md — Descope terminology/lingo, Flow structure and templates, Widgets, SSO Setup Suite, Console-vs-code decision guidereferences/frontegg-detection-patterns.md — codebase search commands for every Frontegg SDK, config, infrastructure, prehook, and webhook surface, plus the known Frontegg env var listConsole-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.
This matters more in a Frontegg migration than in most others. Frontegg's self-service portal is unusually broad — users, groups, roles, security policy, SSO, SCIM, audit logs, webhooks, and API tokens are all end-customer-facing screens the customer never wrote. If those workflows get rebuilt as custom code, the migration balloons. Map them to Descope Widgets and the SSO Setup Suite first, and only write code for what genuinely isn't covered.
Match first, then enhance. Rebuild what Frontegg 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 — hosted vs. embedded login, Flow vs. custom code,
Widget vs. custom page, password strategy, how Applications map, programmatic SSO vs. SSO Setup
Suite — 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 Frontegg usage before you map it. Frontegg ships 17 SDKs across web, backend, and mobile (including separate entitlements-only packages), and some stacks (Java, .NET) have no general-purpose Frontegg SDK at all — meaning those apps hand-rolled JWT verification. Confirm what the app actually uses before mapping anything.
Don't assume the whole platform is in scope. Entitlements, feature flags, and the AI-agent tooling are adjacent products that happen to live in the same dashboard. Establish scope in triage rather than discovering it mid-migration.
Frontegg configuration often lives outside the repo. Login-box settings, security rules, prehooks, SSO/SCIM connections, roles, and portal modules are configured in the Frontegg portal (or the Frontegg Terraform provider), and prehooks often run in a separate service. Ask for them rather than inferring the auth experience from code alone.
iss/kid only to pick the
verifier; each branch verifies the signature against that provider's JWKS.FRONTEGG_JWT_PUBLIC_KEY) — they reject
every Descope token without an obvious error.fe.* permissions wholesale — they gate the portal that
is being replaced.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 Frontegg. Quick check (case-insensitive): grep the repo for
frontegg (packages, imports, *.frontegg.com domains, FRONTEGG_ env vars, Frontegg.plist).
| What the repo shows | Result |
|---|---|
Any Frontegg package, import, env var, or *.frontegg.com / Frontegg custom-domain reference | Frontegg — proceed |
| Another identity provider (Auth0, Okta, WorkOS, Stytch, PingOne, Azure AD B2C, Cognito, Keycloak, a homegrown OIDC server) | Stop and name the matching skill if one exists (auth0-to-descope, okta-cis-to-descope, workos-to-descope, stytch-to-descope, pingone-to-descope, azure-ad-b2c-to-descope); otherwise point to docs.descope.com/migrate |
| No identity provider visible — config in a secrets store, app settings, or a pipeline | Ask |
When asking, use AskUserQuestion: "Which service does this app sign in with?" — Frontegg / Other
(name it). Proceed only on an explicit "Frontegg". The code wins over the request: if the user says
"Frontegg" but the repo shows another provider, ask.
When stopping, say what you found and where to go:
This skill covers Frontegg 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) 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 SDK version
found rather than offering a menu of every framework Frontegg supports, presenting the detected login
mode as a confirmation rather than an open question, and skipping questions in the feature-usage call
entirely for categories the scan found zero evidence of. Triage then does two things: confirms
what the scan found (cheap to get wrong if assumed silently, cheap to confirm explicitly) and asks
only what code cannot reveal — production user/account counts, migration goal, password strategy,
whether prehooks live in another service, which portal modules are actually enabled versus merely
available. 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 small app with a handful of components and one env file does not need the same triage volume as a multi-tenant platform with prehooks and SSO. If the scan shows no evidence of a feature category (ReBAC, SCIM, M2M, entitlements, user pools, AI agents, 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 second-call catalogue item by item.
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):
https://[frontegg-domain]/oauth/account/login and the app calls
loginWithRedirect(). Embedded means the Frontegg SDK injects /account/login,
/account/sign-up, and /account/logout routes into the app itself. Hosted is Frontegg's default.
Hosted apps map to Descope-hosted login (the Descope SDK with oidcConfig +
sdk.oidc.loginWithRedirect()) — the smallest UX change, since users already leave the app to
sign in. Embedded apps map to an embedded <Descope flowId> component. See Step 1.5 item 3 for the
decision tree. Mobile apps are always hosted and run a Descope Flow through the native SDK. If they
don't know, the signal is
hostedLoginBox / FRONTEGG_HOSTED_LOGIN (for the Next.js Pages Router, the SDK deprecates
the prop in favor of the env var; the App Router quickstart still requires the hostedLoginBox
prop alongside the env var, so check which router is in use before assuming the prop is dead), or
the Console's Login method setting. Do not infer the mode from keepSessionAlive,
useAuthUser() (it exists in both modes), or the mobile embeddedMode / EmbeddedAuthActivity
settings — none of those distinguish the two. useLoginWithRedirect() / loginWithRedirect()
calls are a reliable hosted signal.Second AskUserQuestion call — Frontegg feature usage (use multiSelect: true):
customLoginBox, localizations, or theme options.switchTenant / tenant switching is used; whether sub-accounts (account hierarchies) are enabled. Descope has native sub-tenants, so this maps — but confirm how deep the nesting goes and whether role inheritance is expected.appId is passed in contextOptions / FRONTEGG_APP_ID / applicationId, whether per-application MFA or auto-assign rules are configured, and whether the applicationId JWT claim is read anywhere.AdminPortal.show()) or hosted (AdminPortal.openHosted() / /oauth/portal).Never / Assignable / Always) gate what end customers can build into custom roles; whether end customers create their own custom roles; whether groups and group roles are used; whether built-in fe.* permissions are referenced in application code.@frontegg/e10s-client against SpiceDB). Flag as high complexity.isEntitledTo, useFeatureEntitlements, or usePermissionEntitlements gate application behavior; whether plans map to billing tiers; whether feature flags are used for release management. Ask whether entitlements are part of the identity migration or a separate effort — see Step 3.native-hosted, via-oidc, via-saml).acr / amr / max_age, and for which sensitive actions.keepSessionAlive / silent refresh, refresh-token rotation, enableSessionPerTenant, custom token templates and targeting rules, which claims the application reads, and how backends verify tokens (Frontegg SDK, JWKS, or a hardcoded public key).AUTH_INITIATED, USER_SIGNUP, USER_INVITE, USER_UPDATE, USER_DELETE, CREATE_TENANT, UPDATE_TENANT, DELETE_TENANT, JWT_GENERATION, SOCIAL_LOGIN_AUTH, OIDC_AUTH, SAML_AUTH, SEND_SMS, SIGN_UP_USER_POOL), whether they are API prehooks or custom-code prehooks, and whether any of them block, challenge, or lock. Flag as high complexity — prehooks are synchronous decision points in the auth path.frontegg.* events the application consumes and whether any of them keep an application database in sync.Authorization) or access tokens (sent in X-API-KEY); which scopes, roles, and audiences are enforced.is-entitled-to-entity-action-tool and entitlements-entities-tool over HTTP), or whether Frontegg's separate AgentLink product (self-hosted component: FrontMCP) is in use as a hosted or self-hosted MCP gateway. These map to Descope's MCP server support (an MCP server is modeled as a Resource, with what the docs call Agentic Clients — Console: Agentic Identity Hub → Clients — registering agent/MCP access), not to Outbound Apps.After both calls, summarize findings and flag high-complexity items before proceeding to Step 0.5. The main high-complexity Frontegg areas are typically user/password export, the self-service portal surface, prehooks, ReBAC on the self-hosted engine, entitlements and feature flags, SCIM, enterprise SSO with JIT, sub-accounts, user pools, M2M, and AI-agent OAuth integrations.
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. The last group of questions below asks which
workflows a Descope Widget or the SSO Setup Suite can absorb — you cannot ask that usefully without
knowing the widget catalog and the self-service portal mapping table. This is the single largest
lever on scope in a Frontegg migration, and asking it vaguely wastes the checkpoint. The
High-Complexity Frontegg 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
POST https://api.frontegg.com/auth/vendor) for any export work. Without them, no user data can be extracted.api.frontegg.com (EU), api.us.frontegg.com, api.au.frontegg.com, api.ca.frontegg.com. Export scripts pointed at the wrong host fail with a vendor-JWT verification error.Codebase scope
hostedLoginBox in contextOptions / authOptions, or FRONTEGG_HOSTED_LOGIN in Next.js. This determines whether the Descope target is Descope-hosted login (oidcConfig) or an embedded Flow component. useLoginWithRedirect / loginWithRedirect() calls imply hosted; useAuthUser exists in both modes and is not a signal.sub, tenantId, tenantIds, roles, permissions, type, applicationId, sid, metadata, profilePictureUrl, email_verified — or custom claims injected by a JWT_GENERATION prehook? These need a Descope JWT Template or Flow custom claims configured before equivalent reads will work.tenantId in many places? The Account → Tenant remap ripples through SSO, SCIM, RBAC, the self-service portal replacement, M2M tokens, and membership checks. Confirm the account model before writing code.FRONTEGG_JWT_PUBLIC_KEY) rather than JWKS — those break silently at cutover rather than loudly.api.frontegg.com, mobile SDKs, or all of the above?Deployment and risk
User and account migration (if they indicated existing users/accounts in Step 0)
How many users and accounts exist? GET /identity/resources/users/v3 caps at 200 users per page, so this determines how long the export takes and whether it needs to be checkpointed.
Password credentials: confirm the strategy explicitly. Frontegg documents a rich inbound migration API (bulk import with bcrypt, scrypt, firebase-scrypt, pbkdf2, argon2, sha256, and sha1 hashes) but no bulk export endpoint and no password-hash export. User profiles can be paged out of the list API; credentials cannot — no response schema in the identity API returns a credential field. Pick the strategy now, because it determines the cutover plan:
freshlyMigrated on each, then switch the app to Descope in one step. During a transition period, the sign-in Flow sends new users and freshlyMigrated users through the Generic HTTP Connector below, so Frontegg checks their 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). No freeze, no final re-export, no downtime, and active users keep their passwords. The user decides how long Frontegg stays on: recommend at least a few months to keep passwords for most active users. After Frontegg is turned off, the remaining freshlyMigrated users verify their email or phone, then go passwordless or reset their password.POST /identity/resources/auth/v1/user) to verify them, and on success the Flow creates the user in Descope and sets the password. Subsequent sign-ins are Descope-native.Every JIT option keeps Frontegg running for a transition period. Ask how long the user can keep it on before recommending one, and recommend at least a few months when passwords matter. See references/implementation-nuances.md → Migrating user and account data.
Do users belong to multiple Accounts? If yes, preserve tenant membership and per-tenant role assignment when mapping to Descope Tenants.
Is vendorMetadata in use? Frontegg recommends it for storing a pre-Frontegg internal user ID, and it is excluded from the JWT. Export it — it is often the join key back to the application's own database.
Are sub-accounts in use? Descope supports sub-tenants natively — a tenant can have multiple sub-tenants, those can nest further, and each has exactly one parent. Confirm two things: what role inheritance mode the hierarchy needs (Full Inheritance, User only, or None), and whether any code reads the hierarchy from the token — the tenants JWT claim is flat and does not encode parentage, so hierarchy-aware request-time logic needs a tenant.subtenant JWT-template claim or a Load/Search Tenant call returning parent / successors. Note also that password settings and session management are always inherited from the parent in Descope.
Which authentication methods are in use? Passkeys and TOTP enrollments do not transfer; users re-enroll. Confirm this is acceptable before committing to a cutover date.
Big-bang cutover or phased? Map each Frontegg Account to a Descope Tenant first — user migration, membership, SSO, SCIM, JIT, and tenant-scoped roles all depend on it.
SCIM is a lifecycle system, not a one-time import. If SCIM is enabled, enterprise directories will keep pushing create/update/deactivate/group events after cutover. Every SCIM workflow must be re-pointed at Descope before cutover, or provisioning silently breaks.
Are they aware that active Frontegg sessions will be invalidated on cutover unless a session-bridging approach is used? Plan for forced re-login or a phased rollout.
Does the app store Frontegg IDs in its own database? If yes, plan an ID mapping table for Frontegg user IDs, tenantId, role IDs, permission keys, group IDs, and application IDs.
Gaps to flag immediately (don't ask — flag these proactively based on Step 0 answers)
Authorization header (client-credentials) or X-API-KEY (access tokens), and identify what scopes and audiences downstream services enforce.Console/Flow/Widget opportunities (flag before codebase analysis, then ask):
customLoginBox or heavily customized Frontegg login screens: ask whether Descope Flows can replace the custom UI or whether the customer requires headless SDK integration.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.
Frontegg ships frontend SDKs (@frontegg/react, @frontegg/nextjs, @frontegg/vue,
@frontegg/angular, @frontegg/js), backend SDKs (@frontegg/client for Node, frontegg
for Python/Flask/FastAPI, github.com/frontegg/go-sdk, and a Java package that covers
entitlements only), and mobile SDKs (iOS FronteggSwift, Android com.frontegg.sdk:android,
React Native, Flutter frontegg_flutter, Ionic Capacitor (@frontegg/ionic-capacitor)). There is no official .NET SDK — .NET
apps use Microsoft.AspNetCore.Authentication.JwtBearer pointed at the Frontegg domain as the
authority. Adapt the file extensions below to whichever surfaces appear in the project.
Run the searches in references/frontegg-detection-patterns.md (broad sweep, frontend SDK
surface, backend SDK surface, entitlements-engine infrastructure, token claims and hand-rolled
verification, env vars, mobile config, dependency manifests, prehook and webhook handlers). Read the
notes beside each search: several of them exist to catch a case the obvious grep misses (Podfiles
need -i; entitlements-engine config lives in compose/Helm files; webhook prefixes need no trailing
dot; frontend quickstarts hardcode contextOptions instead of using env vars).
For each hit, record:
Read package.json (or equivalent) for the exact framework and SDK versions. Frontegg gates several
behaviors on minimum SDK versions (multi-app support, enableSessionPerTenant, silentReload on
switchTenant, entitlements, AdminPortal.openHosted()), so the installed version tells you which
features could have been in use. Next.js version also affects async behavior (15 vs. 14).
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, accounts, and existing user records carry over — and one on what does: active Frontegg sessions end at cutover, so users sign in once more.
Include a Migration at a Glance table:
| Approach | Full native migration |
| Login model | Frontegg hosted → Descope-hosted login (oidcConfig) / Frontegg embedded → embedded Flow |
| Files changing | N source files across N areas |
| Console setup | N configuration steps before launch |
| User impact | Users sign in once after cutover; with a JIT transition they keep their password, otherwise they verify email/phone and reset or go passwordless |
| 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, Frontegg handles everything related to login: the Frontegg login box (hosted at
[subdomain].frontegg.comor embedded via injected/account/loginroutes) renders the sign-in experience, issues an access token plus afe_refreshcookie, and the backend SDK'swithAuthenticationmiddleware validates the token on every request — readingtenantId,roles, andpermissionsoff the JWT. After this migration, Descope takes over all of those responsibilities. The login UI becomes a Descope Flow. Session validation moves to the Descope SDK, reading theDScookie. Frontegg Accounts become Descope Tenants.FRONTEGG_CLIENT_ID,FRONTEGG_API_KEY, andFRONTEGG_BASE_URLare replaced byDESCOPE_PROJECT_ID(plus a Management Key for server-side administration).Frontegg features in use that need to carry over: [list in plain English, one clause each].
Tailor to triage findings.
For every Frontegg touchpoint found in triage, produce a concrete, one-to-one mapping — Frontegg 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/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 the Frontegg login box, whether
hosted or embedded), initiating authentication, holding the session on the client, refreshing
the token, and reading the current user for UI purposes. This replaces FronteggProvider /
FronteggAppProvider, useAuth(), useAuthUser(), useLoginWithRedirect(),
useIsAuthenticated(), useTenantsActions(), and ContextHolder. 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
withAuthentication(), IdentityClient.validateIdentityOnToken(), FronteggSecurity(...),
frontegg.WithAuthentication(...), or a hand-rolled jwt.verify against
FRONTEGG_JWT_PUBLIC_KEY), checking roles and permissions, and — with a Management Key — all
administrative operations done by ID (user and tenant CRUD, role/permission definitions,
SSO/SCIM configuration, ReBAC). This also replaces every direct call to api.frontegg.com.For each file or area, name the Frontegg call, the Descope SDK that replaces it, which side it runs
on, and the reason (e.g. "session validation must stay server-side because the Management Key cannot
ship to the browser"). When one Frontegg feature spans both sides — for example the login box (now a
client Flow) plus per-request withAuthentication validation (now the backend SDK) — split it into
its client half and its backend half so the reader sees exactly what moves where, and why.
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 Frontegg token validation.
| File | What it does today | What changes |
|---|---|---|
lib/auth.ts:34 | Calls identityClient.validateIdentityOnToken(); returns sub, tenantId, roles, permissions | Rewritten to return Descope authInfo; a thin adapter layer preserves the shape callers expect |
middleware.ts:12 | Runs withAuthentication() and blocks unauthenticated requests app-wide | Updated to validate the Descope DS cookie via validateSession(); logic is identical, SDK call changes |
Login / auth UI (2 files) — These mount the Frontegg provider and trigger the login box. Descope replaces this with an embedded Flow component (or hosted Flow).
| File | What it does today | What changes |
|---|---|---|
app/layout.tsx | Wraps the app in FronteggAppProvider with contextOptions | Replaced with Descope AuthProvider projectId={...} |
app/login/page.tsx | Calls loginWithRedirect() (hosted) or relies on injected /account/login (embedded) | Replaced with <Descope flowId="sign-up-or-in">, or sdk.oidc.loginWithRedirect() for the hosted model |
Cover all functional groupings found — tenant switching, self-service portal embeds, entitlement checks, prehook handlers, webhook handlers, M2M token issuance, mobile SDK auth. End with: "Total: N files. Estimated code-change effort: N–N hours."
For each Frontegg 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:
Multi-tenancy (Frontegg Accounts → Descope Tenants) Frontegg calls the top-level customer object an Account, and the docs state that Accounts and Tenants are the same thing — the JWT carries
tenantIdfor the active account andtenantIdsfor every account the user belongs to. Descope has the same concept, called Tenants. In most migrations, map one Frontegg account to one Descope tenant ID.Most code that handles Frontegg accounts is management code that passes a
tenantIdto the Frontegg API — loading an account, updating settings, managing users, assigning roles, configuring SSO or SCIM. That becomes Descope tenant/user management code that passes a Descope tenant ID to the relevant operation. This is mostly by-ID management work, not token parsing.The main request-time difference is the session shape. Frontegg puts the active account in a flat
tenantIdclaim and the full membership list intenantIds. Descope exposes the active tenant asdctand per-tenant roles and permissions as a keyedtenantsobject. Prefer SDK helpers such asvalidateTenantRoles(...)orvalidateTenantPermissions(...)over reading claims by hand.Confirm the account→tenant mapping first, since it ripples into SSO, SCIM, RBAC, the self-service portal replacement, M2M tokens, and any application tables storing
tenantId. If sub-accounts are in use, they map to Descope sub-tenants — decide the role-inheritance mode explicitly, and check whether any code reads hierarchy from the token, since thetenantsclaim is flat.
Effort: Medium (1–2 hours of code changes). Confirm the account data migration path first.
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:
FRONTEGG_CLIENT_ID and FRONTEGG_BASE_URL in the app's environment variables.localhost:3000, app.myapp.com) — not the Frontegg-style full callback
URLs like http://localhost:3000/oauth/callback.sign-up-or-in flow works for most apps and requires no
customization to start.email, name, or
profilePictureUrl off the token shows nothing after login until this is configured.
(~10 minutes)Required before production:
Diff table with plain-English notes for each removal and addition:
| Remove | Add | Why |
|---|---|---|
FRONTEGG_CLIENT_ID | DESCOPE_PROJECT_ID | Frontegg's per-environment client identifier. Descope uses a Project ID for the same purpose. |
FRONTEGG_API_KEY | DESCOPE_MANAGEMENT_KEY | Frontegg's environment secret, used to mint a vendor token for management APIs. Descope session validation needs only the Project ID; a Management Key is required only for server-side user/tenant/SSO/SCIM administration. |
FRONTEGG_BASE_URL | (none) | Frontegg's per-environment domain. Descope SDKs resolve the endpoint from the Project ID, so no base URL is needed unless a custom domain is configured. |
FRONTEGG_APP_URL | (none) | Used by Frontegg to build redirect URLs. Descope uses Approved Domains configured in the Console instead. |
FRONTEGG_APP_ID | (depends) | Only if multi-app is in use. Decide whether each Frontegg Application becomes its own Descope Project or a Federated/Inbound App. |
FRONTEGG_ENCRYPTION_PASSWORD, FRONTEGG_COOKIE_NAME, FRONTEGG_HOSTED_LOGIN, FRONTEGG_JWT_PUBLIC_KEY | (none) | Next.js session-cookie encryption, cookie naming, login-mode toggle, and the inlined signing key. Descope manages the DS/DSR cookies and key rotation itself. |
FRONTEGG_*_SERVICE_URL, FRONTEGG_API_GATEWAY_URL | (none) | Per-service and regional endpoint overrides. Not needed. |
(frontend, if present) contextOptions hardcoded baseUrl / clientId | NEXT_PUBLIC_DESCOPE_PROJECT_ID or framework equivalent | Frontegg quickstarts often hardcode these inline rather than using env vars. Replace with the Descope Project ID exposed to the browser. |
Follow with: "Net change: 4–8 variables removed, 2–3 added. No secrets need to be rotated on the Frontegg side — those credentials stop being used, though the Frontegg environment should be retained read-only until the migration is verified."
Prose strategy first, then steps. Start with: "X existing users across Y accounts need to be in Descope before cutover." Describe:
End with a brief checklist of the migration steps at the level a PM can track. For a full migration, the agent writes the export/import script (Step 3 → User & Account Data has the endpoints and mapping):
fronteggId, metadata, mfaEnrolled, provider) in the Descope Console before the first run, and confirm the attribute schemafreshlyMigrated on every imported userfreshlyMigrated users. New users get Sign Up / Password. Imported users get an OTP or magic-link step, then Update Password, then the flag is clearedfreshlyMigrated users to email/phone verification plus password reset or passwordlessFor a JIT-only migration (no bulk import), the checklist is different:
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: Frontegg does not export password hashes Frontegg's documented migration API is inbound only, and no user-management endpoint returns a credential field. If the plan assumes passwords transfer, the cutover date is wrong. Action: Default to a full import plus a JIT transition through a Generic HTTP Connector, which keeps passwords for users who sign in while Frontegg is still on. Agree on the transition length now (a few months recommended). If Frontegg must be turned off at the switch, users verify their email or phone and then reset their password or go passwordless.
Consideration: the self-service portal is a large surface, not a component Frontegg's portal gives end customers screens for users, groups, custom roles, security policy, SSO, SCIM, audit logs, webhooks, and API tokens. Rebuilding all of it as custom code can cost more than the rest of the migration combined. Action: Inventory which modules are actually enabled and used, map them to Descope Widgets and the SSO Setup Suite, and get an explicit decision on anything with no widget equivalent.
Consideration: account-to-tenant mapping affects almost every B2B feature If this mapping is wrong, SSO, SCIM, roles, permissions, domain routing, and membership checks may all break. Action: Confirm the account model — including sub-accounts — before writing migration code.
Consideration: SCIM is a lifecycle system, not just a user import Enterprise directories keep creating, updating, and deprovisioning users after cutover. Action: Identify every SCIM connection and re-point it at Descope before cutover.
Consideration: user profile data won't appear after login until a JWT Template is configured Frontegg's access token carries
name,email_verified, andprofilePictureUrlby default; Descope's does not. Any UI displaying user information shows blank values until the template is configured. This is a one-time Console step, not a code change. Action: Configure the JWT Template before running any tests. Estimated time: 10 minutes.
Consideration: entitlements and feature flags are not part of Descope If
isEntitledToor feature flags gate application behavior, that logic needs a home. Action: Decide whether the access-control portion maps to Descope roles/permissions and tenant custom attributes, and treat general feature flagging as a separate workstream.
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 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/oauth/callback)sign-up-or-in to start)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)tenantId; request-time reads use dct/tenants (varies)Phase 3 — User & Account Migration (~1–2 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
freshlyMigrated usersTotal estimated engineering effort: N–N hours across N engineers. Blocking dependencies: (list anything on the critical path — console access, Frontegg API key for export, SCIM re-point, password reset 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 14, Express + React]
- Language: [TypeScript / Python / Go]
- Package manager: [npm / yarn / pnpm / pip / etc.]
- Frontegg login model: [Hosted / Embedded]
- Migration goal: [Full cutover / Phased / Evaluating]
## Triage Answers
- Existing users: [Yes — N users / No — greenfield]
- Existing accounts: [Yes — N accounts → tenants / No]
- Sub-accounts in use: [Yes / No]
- Password strategy: [Full migration + JIT transition (recommended) / Full migration + verify and reset or passwordless / JIT via Generic HTTP Connector only / JIT via Frontegg as OIDC provider]
- JIT transition length: [e.g. 3 months]
- Frontegg features in use: [comma-separated list]
- Frontegg environments: [Dev / Staging / QA / Prod — how many]
- Frontegg region: [EU / US / AU / CA]
- Zero-downtime required: [Yes / No]
## Files Inventory
_All files that need to change. Update status after each step._
| File | Change | Status |
|---|---|---|
| `app/layout.tsx` | Replace FronteggAppProvider | ⬜ Pending |
| `lib/auth.ts` | Rewrite session helper | ⬜ Pending |
| `middleware.ts` | Update session check | ⬜ 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/oauth/callback`)
- [ ] JWT Template configured
- [ ] Tenants created for each Frontegg Account: (list)
- [ ] Roles and permissions created: (list)
- [ ] SSO connections / SSO Setup Suite configured: (list)
- [ ] Social providers configured with real OAuth credentials: (list providers)
## Decisions Log
_Non-obvious decisions made during migration — preserves rationale if context is lost._
_(none yet)_
## Current Phase
Phase 1 — Console Setup (not started)
## Next Action
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 14 · Phase 2, step 3/8 · Next: rewrite lib/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 "from '@frontegg/\|from \"@frontegg/\|require('@frontegg/\|import frontegg\|from frontegg\|frontegg/go-sdk\|com\.frontegg" \
--include="*.ts" --include="*.tsx" --include="*.js" --include="*.jsx" \
--include="*.py" --include="*.go" --include="*.kt" --include="*.java" .
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. Frontegg's user object
is flat and carries tenantId / tenantIds / roles / permissions at the top level; Descope's
authInfo nests tenant data differently. 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. 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 Frontegg's version number or rely on training data for versions. Before writing any
install command:
npm view @descope/node-sdk version
npm view @descope/nextjs-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.Required for: user management API, role/permission management, tenant operations, SSO/SCIM configuration, ReBAC (FGA), Outbound Apps. If the app does any server-side user, tenant, SSO, or SCIM management — or if you are running a user import — they need this.
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.Hosted vs. embedded: match the existing login model. Use AskUserQuestion to confirm, then
follow this tree:
Frontegg login mode today?
├── Hosted (loginWithRedirect(), /oauth/account/login — Frontegg's default)
│ SPA / client-rendered web app → Descope-hosted login: Descope SDK with oidcConfig
│ (<AuthProvider projectId oidcConfig> + sdk.oidc.loginWithRedirect())
│ Server-side web app → Standard OIDC library pointed at Descope (or the Descope SDK)
│ Customer asks for in-page login → Embedded <Descope flowId="..."/> instead
├── Embedded (injected /account/login, /account/sign-up routes)
│ → Embedded <Descope flowId="..."/> on the app's own login route
└── Mobile (always hosted in Frontegg) → Descope Flow through the native SDK
Descope-hosted login keeps the redirect UX Frontegg users already have: the SDK redirects to the
Descope-hosted page and back to redirect_uri (defaults to the current URL), and
sdk.oidc.logout({ post_logout_redirect_uri }) replaces the Frontegg logout navigation. Verify the
oidcConfig options for the user's SDK via the MCP
(React guide). If the app's frontend
calls its own API with scoped access tokens, point oidcConfig at an Inbound App and Resource instead
of the project default.
Ask whether the Frontegg app had a custom domain, and if so, whether it existed for branding or to dodge third-party-cookie failures on the refresh endpoint (see Step 4) — either reason argues for a Descope custom domain too. 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.
Console → Project Settings → General → Security → Approved Domains.
Descope validates redirect URLs against this domain list — not full redirect URIs the way
Frontegg's allowed-origins and callback registrations do. Enter domain only: no http:// or
https://, no path.
localhost:3000 (include port)myapp.com or app.myapp.comDo not carry over Frontegg callback URLs like http://localhost:3000/oauth/callback. Descope
embedded Flows complete auth client-side; there is no /oauth/callback route to whitelist. Note
also that Frontegg's allowed origins support wildcards (https://*.acme.com) — confirm how any
wildcard entry should be represented before assuming a one-to-one copy.
Frontegg's access token carries profile claims by default; Descope's does not.
{"email": "{{user.email}}", "name": "{{user.name}}", "picture": "{{user.picture}}"}.
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 — this is a
common way to "do everything right" and still get no tenant/role data at request time.ValidateJwtTemplate operation (dry-run; a
CreateJwtTemplate call with bad shape fails validation up front rather than saving something
broken) — either via the Descope MCP if available, or the equivalent Console preview.token.email,
token.name, or token.profilePictureUrl will get undefined after migration.JWT_GENERATION prehook, those belong
here too (or in a Flow custom-claims action). See Step 3 → Prehooks.Descope roles are referenced by name, not by ID. They must be created before the code that assigns them will work.
roles JWT claim, so migrate the keys.fe.* permissions (e.g. fe.secure.read.users) exist to gate the Frontegg
self-service portal. Do not recreate them wholesale — they only matter if application code
reads them. Recreate the customer's own permission keys instead.Frontegg has two metadata fields with different semantics: metadata is included in the JWT, and
vendorMetadata is deliberately excluded from it and is often where a pre-Frontegg internal user ID
was stored. Both map to Descope custom attributes, which should be pre-defined in the Console schema
before being set via the SDK.
freshlyMigrated or fronteggId at import time — define them first.tenant.subtenant is a boolean for
the currently selected tenant only — it says whether that tenant has a parent, not which parent,
and nothing about the user's other tenants. Anything richer needs a server-side Load/Search Tenant
call reading parent / successors.| 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, SSO/SCIM, user import, Outbound Apps API |
Before migrating anything the Frontegg self-service portal used to handle, ask whether a Descope
Widget or the SSO Setup Suite covers the use case. This is the single largest opportunity to avoid
writing code in a Frontegg migration. See references/flows-and-widgets.md → Widgets and
Step 3 → Self-service portal.
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 of whether it's actually provisioned — 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 elevation. Before manually clicking through the Console:
sign-up-or-in flow, a Tenant Admin role, and several default widgets
(profile, user management, role management, access keys) typically ship with every project. 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.
Frontegg publishes three SDK families:
@frontegg/react, @frontegg/nextjs, @frontegg/vue, @frontegg/angular, @frontegg/js (plus the shared @frontegg/types and @frontegg/rest-api). These render the login box, hold the client session, and expose auth state through hooks or observables.@frontegg/client (Node), frontegg (Python — Flask and FastAPI), github.com/frontegg/go-sdk. The Java packages (com.frontegg.sdk:entitlements-client*) cover entitlements only, and there is no official .NET SDK — .NET apps use Microsoft.AspNetCore.Authentication.JwtBearer with the Frontegg domain as the authority.FronteggSwift), Android (com.frontegg.sdk:android), React Native, Flutter (frontegg_flutter), Ionic Capacitor (@frontegg/ionic-capacitor). Mobile always uses hosted login.The recipes below map each Frontegg SDK to its Descope target — one section each.
The framework recipes below are stubs listing the Frontegg idioms that need mapping. Confirm the exact Frontegg SDK surface for the user's stack and the matching Descope SDK calls via the Descope MCP or local type declarations before generating any code. Do not ship code from these stubs 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.
FronteggProvider / FronteggAppProvider / FronteggAppModule.forRoot() / app.use(Frontegg, …) / initialize({...}) → Descope AuthProvider (or the framework's equivalent provider), configured with the Project ID instead of baseUrl + clientId + appIdloginWithRedirect() → Descope-hosted login: AuthProvider with oidcConfig + sdk.oidc.loginWithRedirect() (see Step 1.5 item 3)/account/login, /account/sign-up routes) → an embedded <Descope flowId> / <descope-wc> component on the app's own login routeuseAuth() / useAuthUser() / authState$ / app.store.getState().auth → Descope useSession() + useUser() hooks (or the framework equivalent)useIsAuthenticated() → useSession()'s authentication stateuseTenantsActions().loadTenants() / switchTenant({ tenantId }) → Descope tenant selection; read membership from the validated session (tenants) and the active tenant from dctContextHolder.getContext() (reading baseUrl, tokens) → Descope SDK session accessors; do not hand-parse the tokenAdminPortal.show() / AdminPortal.openHosted() → Descope Widgets and the SSO Setup Suite (see Step 3)useFeatureEntitlements() / usePermissionEntitlements() / isEntitledTo() → Descope roles/permissions where the check is access control; otherwise out of scope (see Step 3)withAuthentication() / validateIdentityOnToken() / FronteggSecurity(...) / frontegg.WithAuthentication(...) → custom middleware calling the Descope SDK's validateSession() against the DS cookieAuthorization: Bearer, refresh in the fe_refresh cookie → Descope signed session JWT in DS, refresh in DSR{baseUrl}/oauth/logout?post_logout_redirect_uri=… → sdk.oidc.logout({ post_logout_redirect_uri }); embedded logout() → Descope two-step logout (see Step 4)fe.* permissions on the client's token. The Descope equivalents require a Management Key, which must never ship to a client. Audit every such call explicitly: it becomes a server endpoint the client calls, or a Descope Widget acting as the logged-in user — never a like-for-like client-side port. This is the kind of code most likely to get carried over verbatim into a credential leak, because it looks like ordinary client code and worked fine on the Frontegg side.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 or pull claims out of it in client code. This is a common Frontegg habit —ContextHoldermakes the raw token easy to reach — and it should not carry over. Server-side session validation belongs only in backend routes, middleware, and API handlers, never in a rendered client component.
Frontegg SDK: @frontegg/react → Descope @descope/react-sdk
<FronteggProvider contextOptions={{ baseUrl, clientId, appId }}> → <AuthProvider projectId>useLoginWithRedirect() → <AuthProvider projectId oidcConfig> + useDescope().oidc.loginWithRedirect() (Step 1.5 item 3); embedded login routes → <Descope flowId> component, wiring onSuccessuseAuth() / useAuthUser() / useAuthUserOrNull() / useIsAuthenticated() → useSession() + useUser()useAuthActions() (requestAuthorize, switchTenant, loadEntitlements) → Descope SDK actions via useDescope(); tenant switching is modeled through Descope tenant context, and loadEntitlements has no equivalentuseTeamState() / useTeamActions().loadUsers() (tenant-user listing/invites/roles, client-side in Frontegg) → server-side only: a route handler using a Management Key, or the User Management Widget — never port this to client code as-isAdminPortal.show() → Descope Widgets (see Step 3)sdk.logout() via useDescope()useUser()/useSession() inline into a useEffect dependency array causes an infinite render loop. Depend on primitives, not the object.references/implementation-nuances.md → React for the fuller version of these gotchas, plus the claim-helper null-handling caveat.Frontegg SDK: @frontegg/nextjs → Descope @descope/nextjs-sdk + @descope/node-sdk
FronteggAppProvider / FronteggAppRouter (@frontegg/nextjs/app) → Descope AuthProvider (takes projectId; must use the NEXT_PUBLIC_ prefix)withFronteggApp / FronteggRouter / getSession / withSSRSession (@frontegg/nextjs/pages) → Descope session() from @descope/nextjs-sdk/server for server-side readsgetAppUserSession() / getAppUserTokens() → session() (server-side only)FronteggApiMiddleware (@frontegg/nextjs/middleware) / handleSessionOnEdge (@frontegg/nextjs/edge) → Descope authMiddleware(options) — exclude API routes from the matcher. Descope's documented matcher includes /(api|trpc)(.*) by default; an unauthenticated fetch() to a matched API route gets a 307 redirect to the sign-in page instead of a 401, breaking client code expecting JSON. Let route handlers validate session() and return their own 401.FRONTEGG_ENCRYPTION_PASSWORD + FRONTEGG_COOKIE_NAME (fe_session stateless cookie) → removed; Descope manages DS/DSRFRONTEGG_HOSTED_LOGIN toggle → removed; hosted apps use Descope-hosted login via oidcConfig, embedded apps render the Flow componentsession() from @descope/nextjs-sdk/server is server-only; useSession()/useUser() from @descope/nextjs-sdk/client are client-only. Using session() in a client component compiles but throws at runtime.session() can still come back undefined on a page reached through authMiddleware. Always null-check session() and redirect — don't treat "the middleware let it through" as proof of a valid session.references/implementation-nuances.md → Next.js for the fuller version of these gotchas.Frontegg SDK: @frontegg/angular → Descope @descope/angular-sdk
FronteggAppModule.forRoot(config) + <frontegg-app> element → Descope Angular module/provider + Flow componentFronteggAppService.isLoading$ and FronteggAuthService observables (user$, authState$, tenantsState$, teamState$) → Descope Angular SDK session/user accessorsloginWithRedirect() / requestAuthorize() / loadTenants() / switchTenant({tenantId}) → Descope login flow + tenant contextFrontegg SDK: @frontegg/vue → Descope @descope/vue-sdk
app.use(Frontegg, { contextOptions, authOptions, hostedLoginBox, router }) → Descope Vue plugin with projectIduseFrontegg() (fronteggLoaded, authState, loginWithRedirect), useFronteggAuthGuard(), mapLoginActions(), mapAuthState() → Descope Vue composables for session and userthis.fronteggAuth.tenantsActions.switchTenant(...) → Descope tenant contextFrontegg SDK: @frontegg/js → Descope @descope/web-js-sdk + @descope/web-component
initialize({ contextOptions, authOptions, hostedLoginBox }) → @descope/web-js-sdk client created with the Project IDapp.ready() / app.store.subscribe() / app.store.getState().auth → getSessionToken(), isJwtExpired(), refresh() and the SDK's session eventsapp.loginWithRedirect() / app.logout() / app.switchTenant(...) → Descope login (hosted or <descope-wc project-id flow-id>), logout(), tenant contextfe-state="isAuthenticated" / fe-mode="hosted" HTML attributes → conditional rendering driven by the Descope SDK's session stateFRONTEGG_AFTER_AUTH_REDIRECT_URL in localStorage → handle post-login redirect in app code or via Flow configurationFrontegg SDK: @frontegg/client → Descope @descope/node-sdk
FronteggContext.init({ FRONTEGG_CLIENT_ID, FRONTEGG_API_KEY }); add the Descope client created with the Project ID (plus Management Key for admin calls)withAuthentication() middleware (which populates req.frontegg.user) with custom middleware calling descopeClient.validateSession(sessionToken) against the DS cookie (parse the cookie yourself)new IdentityClient({...}) + identityClient.validateIdentityOnToken(token, { roles, permissions }) with validateSession() plus the SDK's role/permission validation helpersAuditsClient / EventsClient → Descope audit events and connectors (see Step 3)local / redis / ioredis) has no equivalent and can be removedFrontegg SDK: frontegg (frontegg.flask / frontegg.fastapi) → Descope descope Python SDK
frontegg.init_app(client_id, api_key) + @with_authentication(role_keys=[...], permission_keys=[...]) (user on g.user) → Descope client + a decorator calling descope_client.validate_session(session_token=session_token)await frontegg.init_app(...) + Depends(FronteggSecurity(permissions=['...'])) → a Descope dependency that validates the DS token and checks permissionsFRONTEGG_DEBUG / frontegg_logger → the Descope SDK's own loggingFrontegg SDK: github.com/frontegg/go-sdk → Descope github.com/descope/go-sdk
frontegg.Init(frontegg.Credentials{ClientID, APIKey}) / frontegg.New(...) → client.New() / client.NewWithConfig(&client.Config{ProjectID: ...}) configured with the Project IDfrontegg.WithAuthentication(middleware.Options{Roles, Permissions}) + middleware.UserFromContext(ctx) → custom middleware calling descopeClient.Auth.ValidateSessionWithToken(ctx, token), which returns (bool, *descope.Token, error)ident.ValidateToken(ctx, token, &identity.ValidateTokenOptions{...}, identity.JWTHeader | identity.AccessTokenHeader) → ValidateSessionWithToken plus Descope role/permission helpersRoles and Permissions options are OR (at least one must match). Confirm the equivalent Descope helper's semantics rather than assuming they matchclient.HostedLogin(redirectURI) → RequestAuthorize / CodeExchange (OAuth 2.1 + PKCE) → Descope hosted flow or SDK logintenantId → a Descope tenant ID: pass it to management calls; at request time read tenant context off the returned *descope.Token (token.GetTenants(), or the dct claim for the active tenant)Frontegg: entitlements-only packages (com.frontegg.sdk:entitlements-client*) → Descope descope-java
jwt library calls against the Frontegg public key). Replace that with authenticationService.validateSessionWithToken(sessionToken) returning a Tokenentitlements-client / entitlements-client-spring-boot-starter and ENTITLEMENTS_ENGINE_TOKEN are present, the app is using the self-hosted entitlements engine — handle that under Step 3 → ReBAC and Entitlements, not hereFrontegg: no official SDK → Descope descope-dotnet
AddJwtBearer with options.Authority = "https://[frontegg-domain].frontegg.com", options.Audience = "[client-id]", NameClaimType = ClaimTypes.NameIdentifier, and role checks against the "roles" claim type. This is a config-level change, usually the smallest migration of any stackdescope-dotnet, or repoint the JWT bearer configuration at Descope's issuer and JWKS if staying with standards-based validationemail/name by default and expose tenants as dct/tenants rather than tenantId/tenantIds — the claim reads change even when the validation mechanism doesn'tAll Frontegg mobile SDKs require hosted login and default keepSessionAlive to true. Frontegg
mobile does not support the self-service portal, entitlements, impersonation, or idle-session
management — so mobile migrations are usually narrower than their web counterparts.
Naming trap:
embeddedModeinFrontegg.plistandEmbeddedAuthActivityon Android select an embedded webview for the hosted login page. They do not indicate an embedded login box. A codebase scan that treats them as evidence of embedded login will invert the Step 0 answer for a mobile app.
Frontegg SDK: FronteggSwift → Descope descope-swift
Frontegg.plist (baseUrl, clientId, applicationId, embeddedMode, regions) → Descope SDK initialization with the Project IDFronteggApp.shared.auth / FronteggAuth.shared / @EnvironmentObject var fronteggAuth / fronteggAuth.isAuthenticated → Descope Swift SDK session APIs.login() / .loginWithPopup(...) / .logout() / handleOpenUrl(url) / AbstractFronteggController → run a Descope Flow via the Swift SDK, or use hosted auth{{IOS_BUNDLE_IDENTIFIER}}://{{FRONTEGG_BASE_URL}}/ios/oauth/callback) must be replaced with the Descope equivalent and re-registeredFrontegg SDK: com.frontegg.sdk:android → Descope descope-kotlin
buildConfigFields FRONTEGG_DOMAIN, FRONTEGG_CLIENT_ID, FRONTEGG_APPLICATION_ID and manifest placeholders (package_name, frontegg_domain, frontegg_client_id) → Descope SDK configuration with the Project IDFronteggApp.init(...) / FronteggAuth.instance.login/logout/switchTenant → Descope Kotlin SDK session and flow APIsEmbeddedAuthActivity / HostedAuthActivity / AuthenticationActivity and the deep-link path prefixes (/oauth/account/activate, /oauth/account/invitation/accept, /oauth/account/reset-password, /oauth/account/login/magic-link) must be replaced with the Descope equivalentsFrontegg SDK: @frontegg/react-native → Descope @descope/react-native-sdk
Frontegg SDK: frontegg_flutter → Descope descope-flutter
FronteggProvider / context.frontegg / FronteggState (accessToken, refreshToken, user, isAuthenticated) → Descope Flutter SDK session statelogin / logout / refreshToken / switchTenant / directLoginAction → Descope Flutter SDK equivalentsAfter 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 Frontegg references in non-code files after updating source files.
.env.example / .env.template / .env.sample# REMOVE
FRONTEGG_CLIENT_ID=
FRONTEGG_API_KEY=
FRONTEGG_BASE_URL=
FRONTEGG_APP_URL=
FRONTEGG_APP_ID=
FRONTEGG_CLIENT_SECRET=
FRONTEGG_COOKIE_NAME=
FRONTEGG_ENCRYPTION_PASSWORD=
FRONTEGG_HOSTED_LOGIN=
FRONTEGG_JWT_PUBLIC_KEY=
FRONTEGG_SHARED_SECRET=
FRONTEGG_COOKIE_DOMAIN=
FRONTEGG_COOKIE_SAME_SITE=
FRONTEGG_SECURE_JWT_ENABLED=
FRONTEGG_REWRITE_COOKIE_BY_APP_ID=
FRONTEGG_FORWARD_IP=
FRONTEGG_SSG_EXPORT=
DISABLE_INITIAL_PROPS_REFRESH_TOKEN=
# 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 FRONTEGG_API_KEY for admin APIs)
Run grep -ir "FRONTEGG" to find all env var references — .env.example, Docker, CI, shell
scripts, Android build.gradle, iOS Frontegg.plist.
Search all .md files for Frontegg references. At minimum, update:
Check Dockerfile, docker-compose.yml, .github/workflows/, and any CI config for FRONTEGG_*
env var declarations. If ReBAC was in use, also remove the entitlements-engine stack — the
Helm values or manifests deploying frontegg/entitlements-engine, any docker-compose services copied from
Frontegg's local example (CockroachDB, frontegg/e10s-engine-sync), the SpiceDB instance if it existed only
for Frontegg, and, on older deployments, the legacy
frontegg/entitlements-agent PDP container. Descope's ReBAC is managed, so this infrastructure goes
away entirely.
Frontegg publishes a Terraform provider, so some or all of the configuration being migrated may live
in .tf / .tfvars rather than the portal. Search for it — IaC-managed Frontegg config is invisible
to a source-code scan, and leaving it in place means the next terraform apply recreates what the
migration just retired. Descope has its own Terraform provider if the customer wants to stay
declarative.
Frontegg.plist, update associated-domain entitlements and URL schemesFRONTEGG_* buildConfigFields and manifest placeholders, remove the Frontegg activities and deep-link intent filtersCheck public/manifest.json-style PWA/web-app manifests for Frontegg references (icons, start URLs,
or scope tied to a Frontegg-hosted domain). These don't break compilation, aren't source files, and
are easy to skip in a code-focused review.
When 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 Node.js/Python script using the Descope Management SDK.After completing non-code file updates: Update MIGRATION-STATE.md — mark env files,
README, CI config, and mobile project files done in the Files Inventory, and advance Next Action.
For each Frontegg 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. The
descope-migration repo's Frontegg module
(src/frontegg_migration.py) is a working reference for request shapes and edge cases. A Frontegg page in Descope's
migration docs may or may not be published when you run this —
check before linking to it. Never tell the user to open a guide you have not confirmed exists.
The paths below are Descope's standard migration shapes — the same ones documented for Keycloak, Cognito, and Azure AD B2C — applied to Frontegg. Recommend Path 1 with Path 2 as its cutover: import everyone, switch the app in one step, and keep the Path 2 connector in the Flow for a transition period. That avoids a freeze, a final re-export, and downtime, and keeps passwords for active users.
Path 1 — Full migration (recommended default). Export accounts, roles, permissions, and users from Frontegg, then create the matching objects in Descope in dependency order: tenants → permissions → roles → users. Whether a tool does this or you script it, the order matters — users cannot be created with tenant and role assignments that do not exist yet.
Things the script must get right: fetch all users without a tenant header, then read per-account role assignments separately (the users list returns tenant roles empty), map Frontegg role keys to Descope role names, import locked users as disabled, and skip phone numbers that aren't E.164.
Passwords do not come along. Set a freshlyMigrated custom attribute on every imported user.
During the transition, the Flow sends those users through the Path 2 connector so Frontegg checks
their password. Because they already exist in Descope, 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. After Frontegg is turned off, the Flow
sends remaining freshlyMigrated users to email/phone verification, then a password reset or a
passwordless method. JIT creates missing users but doesn't update roles of imported users, so
re-sync accounts and role assignments once right after the switch. Set verifiedEmail /
verifiedPhone where Frontegg already marked them verified.
Path 2 — JIT migration with a Generic HTTP Connector. The only way to keep existing passwords,
either as the cutover for Path 1 or on its own. The Descope Flow collects email and password, a
Generic HTTP Connector
calls Frontegg's "Authenticate user with password" API (POST /identity/resources/auth/v1/user; it
returns a Frontegg user token, so read the user ID and tenant from that JWT or a follow-up user API
call), and on success the Flow creates or updates the Descope user, sets their password, and issues a Descope session. Later sign-ins skip Frontegg entirely.
Path 3 — JIT migration with Frontegg as a custom OIDC provider. Configure Frontegg as a custom OAuth/OIDC provider in Descope using the Frontegg OIDC client credentials and endpoints, then add an OAuth sign-in step to the Flow. Users authenticate through Frontegg'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 so they stop hitting Frontegg.
Both JIT paths keep Frontegg 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 during the transition (see Step 4).
The script's shape: mint an environment token
(POST {region gateway}/auth/vendor with { clientId, secret }; the EU gateway is
https://api.frontegg.com, others are api.us., api.ca., api.au.frontegg.com), list accounts via
GET /tenants/resources/tenants/v2, create the matching Descope tenants, then page users with
GET /identity/resources/users/v3 (_limit max 200; note _offset is a page index, not a record
offset — pass 0, 1, 2… and loop until _metadata.totalPages, not _offset += 200, or the export
truncates silently; add the frontegg-tenant-id header for tenant-scoped export). Map email → Descope loginId, name → name, phoneNumber → phone, each
tenants[].tenantId → a Descope tenant membership (userTenants[]; the item-level tenantId is
only the active account), and metadata → custom attributes defined in Descope first. Get each
membership's roles from the per-account GET /identity/resources/users/v3/roles call and resolve its
roleIds to role keys with the GET /identity/resources/roles/v1 list. Import with
POST /v1/mgmt/user/create or POST /v1/mgmt/user/create/batch. See
references/implementation-nuances.md → Migrating user and account data.
Effort: Low for the scripted export on a clean data set; Medium–High for JIT paths, which are Flow engineering plus a dual-validation rollout rather than a one-off script.
Frontegg's login box handles sign-in and sign-up, in hosted or embedded mode, across a fixed set of identifiers (email, username, phone number) and credential types. Descope maps these to Flows, authentication methods, and Console configuration.
| Frontegg | Descope |
|---|---|
Hosted login box (/oauth/account/login) | Descope-hosted login via the SDK's oidcConfig + sdk.oidc.loginWithRedirect() (optionally behind a custom domain). See Step 1.5 item 3. |
Embedded login box (injected /account/login, /account/sign-up) | Embedded <Descope flowId> / <descope-wc> component |
customLoginBox / custom login screens | Custom Flow in the visual builder, or headless SDK |
| Login identifiers: email / username / phone | Descope login identifiers configured per method |
| Password | Descope Passwords |
| Magic link | Descope Magic Link / Enchanted Link |
| Magic code / Email OTP / SMS OTP | Descope OTP methods |
| Passkeys / WebAuthn | Descope Passkeys |
| Device flow | Device-code style Flow — confirm support before promising it |
| Social logins (Google, Microsoft, GitHub, Facebook, Apple, LinkedIn, Slack, custom OAuth) | Descope OAuth/social providers |
| Localizations / theme options | Descope Flow localization and Styles |
| Email templates | Descope Messaging Templates |
Two Frontegg-specific notes. First, Frontegg supplies shared development OAuth credentials for every social provider except LinkedIn — so an app with working Google login may never have registered its own OAuth application. Descope requires real provider credentials, so budget setup time per provider. Second, Frontegg auto-merges users across login methods on email, and if email verification was disabled, a user who signed up socially and later used a password is forced through a reset. Check the environment's verification setting before assuming the exported user set is clean.
Effort: Low–Medium for straightforward auth; higher with heavy login-box customization.
Frontegg calls the customer-level object an Account, and its docs state that Accounts and Tenants
are the same thing. A user belongs to one or more accounts; the JWT carries tenantId (active) and
tenantIds (all). Descope models this as Tenants and users associated with tenants.
| Frontegg | Descope |
|---|---|
| Account / Tenant | Tenant |
tenantId (active account claim) | dct claim (Descope Current Tenant) |
tenantIds (membership claim) | tenants claim (keyed object with per-tenant roles/permissions) |
switchTenant({ tenantId }) | Descope tenant selection / active tenant handling |
enableSessionPerTenant (per-tab tenant) | Tenant context handled per session — confirm the equivalent behavior explicitly |
| Account details (name, address, website, timezone, currency) | Tenant name + tenant custom attributes |
| Account plan assignment | See Entitlements below |
| Account-level security policy | Tenant settings + Flow conditions |
| Custom login per account | Tenant-specific Flow / tenant routing |
| Account lock | Tenant-level access control — confirm the equivalent |
| Sub-accounts (hierarchy) | Sub-tenants — one parent per tenant, nesting supported, with configurable role inheritance |
Sub-accounts map to Descope sub-tenants: a tenant can have multiple sub-tenants, those can nest
further, and each sub-tenant has exactly one parent. Role inheritance is configurable (Full, User
only, or None), and sub-tenants can carry their own SSO configuration, custom attributes, and RBAC.
Two constraints to plan around: password settings and session management are always inherited
from the parent, and the tenants JWT claim is flat — it does not encode parentage. Code that
needs hierarchy at request time uses a tenant.subtenant JWT-template claim, or a Load/Search Tenant
call returning parent and successors.
Effort: Medium — conceptually clean, but application code often assumes Frontegg's flat
tenantId/tenantIds claim shape. Medium–High with sub-accounts, mostly because role
inheritance and hierarchy-aware token reads need explicit decisions.
Frontegg supports up to four environments (Development, Staging, QA, Production) under a workspace, each fully isolated with its own Client ID, API Key, and Frontegg domain. Each becomes a separate Descope Project with its own Project ID.
One behavioral difference worth calling out: Frontegg lets you publish a login box and self-service portal configuration from one environment to another. Descope projects are configured independently. For teams that relied on publishing, recommend scripting environment setup with the Management SDK (roles, tenants, SSO configuration) so that promoting configuration stays repeatable, and keep Flow changes as a deliberate per-project step.
Effort: Low per environment, but multiply the Console setup checklist by the number of environments.
Frontegg's Applications let several apps share one environment, one login box, and one credential
set, distinguished by appId in contextOptions, FRONTEGG_APP_ID, applicationId in
Frontegg.plist, FRONTEGG_APPLICATION_ID on Android, and the appId query parameter on
/oauth/authorize. The applicationId JWT claim identifies which app a session belongs to.
There is no single Descope equivalent — pick based on what the Applications were doing:
| What Frontegg Applications were used for | Descope approach |
|---|---|
| Genuinely separate products with separate users | Separate Descope Projects |
| One product, multiple surfaces, shared users, single sign-on between them | Federated Apps (Descope as IdP across apps you own) |
| Third-party or external clients needing scoped access | Inbound Apps |
| Per-application MFA / auto-assign rules | Flow conditions and tenant/user attributes |
Reading applicationId for feature gating | Roles/permissions or a JWT Template claim |
Ask which of these the Applications actually represent before choosing. Note the Frontegg quirk that
the query parameter is appId, not app_id — useful when grepping for usage.
Effort: Medium — the decision matters more than the code.
This is usually the largest single item in a Frontegg migration. Frontegg's self-service portal is a
broad end-customer-facing surface — embedded via AdminPortal.show() or hosted at
/oauth/portal — covering workflows the customer never wrote. Do not default to rebuilding these
screens as custom code.
| Frontegg portal module | Descope replacement |
|---|---|
| Profile settings | User Profile Widget |
| Privacy & Security (password, MFA enrollment) | Flow-driven MFA/password management, or profile widget |
| Personal (user) API tokens | Access Keys, or an Inbound App per client — see M2M |
| Account details (name, address, timezone, currency) | Tenant Profile Widget + tenant custom attributes |
| Users: invite, enable/disable, revoke sessions, resend activation | User Management Widget |
| Invite links (invitee inherits inviter's roles) | Invitation Flow — confirm role-inheritance behavior explicitly |
| Guest / temporary users with an access period | No direct equivalent — model with a custom attribute plus expiry logic, or a scheduled deprovisioning job |
| Groups and group roles | Roles + tenant membership; SCIM/SSO group mapping where groups come from an IdP |
| Custom roles created by end customers ("copy permissions from") | Role Management Widget where available; otherwise Management SDK behind your own UI |
| Security policy: MFA, lockout, password history, session settings | Console project/tenant settings + Flow conditions |
| IP and domain restrictions (allowlist/denylist, CIDR) | Flow conditions and Connectors — confirm coverage per restriction type |
| SSO self-serve setup | SSO Setup Suite |
| SCIM provisioning setup | SSO Setup Suite SCIM configuration |
| Audit logs (with end-user CSV export) | Audit events + Audit Widget; export via Audit Webhook / connectors |
| Webhooks subscribed by end customers | No direct equivalent — this is an application feature, not an identity one; plan to own it |
Inventory which modules are enabled in Builder and actually used, not which exist. Frontegg gates
portal visibility on both a Builder toggle and an fe.* permission, so the enabled set is often much
smaller than the full catalog. For each module with no widget equivalent — guest users, end-customer
webhook subscriptions, customer-managed audit export — get an explicit decision: build it, drop it,
or defer it.
Effort: Medium–High — it can remove code if widgets cover the workflows, or become the biggest line item if the portal was heavily used.
Frontegg roles carry a Name, Description, Key (what lands in the roles JWT claim), a numeric
Level, a permission list, and assigned accounts. Permissions have a Key, a Category, and a
classification type (Never / Assignable / Always) governing whether end customers may use
them in custom roles. Descope has Roles and Permissions with the same core semantics, at project and
tenant level.
| Frontegg | Descope |
|---|---|
| Role key | Role name (referenced by name, not ID) |
| Permission key | Permission |
Wildcard permissions (fe.secure.read.*, fe.secure.*) | No equivalent — Descope has no wildcard permission matching. Expand each wildcard into explicit permissions |
| Default role (auto-assigned on signup) | Flow-assigned role / tenant default |
| System role (applies to all accounts) | Project-level role |
| Role assigned to specific accounts | Tenant-level role assignment |
| Custom roles created by end customers | Role Management Widget or Management SDK |
roles / permissions JWT claims | roles / permissions claims (nested per tenant under tenants) |
| Group roles (computed at login) | SCIM/SSO group-to-role mapping |
Role Level (numeric hierarchy limiting who can assign what) | No equivalent — enforce in application logic or via permission design |
| Permission classification type | No equivalent — decide which permissions end customers may self-assign in application/widget logic |
Built-in fe.* permissions | Do not recreate wholesale — they gate the Frontegg portal, which is being replaced |
Two Frontegg behaviors to check for and, ideally, fix during the migration. Frontegg's own docs note that role changes do not take effect until the current token expires — apps often shortened JWT lifetime to compensate, and that workaround may no longer be needed. And group roles appear in the JWT but are not visible from the management section of the Frontegg portal, so the exported role assignments may not match what users actually get at login; reconcile against a decoded token, not just the API.
Effort: Medium for normal RBAC; higher if role levels or classification types encode real policy.
Frontegg's ReBAC is not a hosted service. Entity types, relations, actions, and assignments are
stored in Frontegg Cloud, but evaluation happens in a SpiceDB instance the customer runs
(self-hosted or managed), fed by the Frontegg entitlements engine (frontegg/entitlements-engine,
deployed via Helm) that syncs from Frontegg roughly every 60 seconds, with the app calling
@frontegg/e10s-client over gRPC. Frontegg's local docker-compose example adds CockroachDB and
frontegg/e10s-engine-sync. Descope's ReBAC is
managed, so this migration removes infrastructure rather than adding it.
Frontegg does not use a text DSL. The schema is assembled from discrete objects — an entity type
(key), relations (relationKey, each declaring a subject entity type), and actions
(actionKey, mapped to the relations that grant them) — with hierarchy expressed as a JSON
relationKeys array mixing direct relations and inherited paths. Schema translation example — the
Frontegg model, assembled via the UI or REST:
Entity type: document
Relations: reader (subject: user), editor (subject: user), parent (subject: folder)
Actions: read → [ "reader", { "fromRelation": "parent", "toAction": "read_folder" } ]
write → [ "editor" ]
The equivalent Descope ReBAC schema:
model AuthZ 1.0
type User
type Folder
relation viewer: User
permission read_folder: viewer
type Document
relation reader: User
relation editor: User
relation parent: Folder
permission read: reader | parent.read_folder
permission write: editor
For the full DSL — intersection (&), exclusion (-), target sets (Group#member), and with
conditions — use the descope-fga-schema skill rather than writing the schema from memory.
| Operation | Frontegg | Descope |
|---|---|---|
| Read the schema | GET /resources/entity-types/v1 | Descope ReBAC schema (Console or Management SDK) |
| Export assignments | GET /resources/relations/v1/assignments | — |
| Write relation | POST /resources/relations/v1/assign | descopeClient.management.fga.createRelations([...]) |
| Remove relation | POST /resources/relations/v1/unassign | descopeClient.management.fga.deleteRelations([...]) |
| Check | e10sClient.isEntitledTo(subject, { type: RequestContextType.Entity, ... }) | descopeClient.management.fga.check([...]) |
| List accessible resources | lookupTargetEntities() / lookupEntities() | Descope FGA resource/subject lookup |
(Verify exact Frontegg and Descope shapes against current docs.) Three Frontegg specifics to
confirm before planning: ReBAC must be enabled by Frontegg support, so some environments have it
configured but unused — check whether isEntitledTo is actually called; relation writes take up to
60 seconds to become enforceable, so any application logic that compensates for that lag can be
removed; and time-bound access implemented with SpiceDB's active_at caveat has no automatic
equivalent and needs an explicit design decision.
Identify entity types, relations, actions, where checks run, and any hierarchical inheritance.
Effort: High — requires a dedicated model review. See
references/implementation-nuances.md → ReBAC migration for the decision guide and the
assignment-export pattern.
Frontegg's entitlements engine bundles Features (named resources, optionally linked to
permissions) into Plans assigned to accounts and users, enforced through isEntitledTo,
useFeatureEntitlements, and usePermissionEntitlements. Descope has no plans product, so this
splits in two.
The access-control half maps cleanly: a feature that is really "may this user do X" becomes a
Descope permission, and a plan that is really "which capabilities does this tenant have" becomes a
tenant custom attribute checked in Flows or application code, or a set of tenant-level roles.
Frontegg's NotEntitledJustification values map roughly onto these: MISSING_PERMISSION is an RBAC
check, MISSING_FEATURE and BUNDLE_EXPIRED are tenant-entitlement state.
Where a Frontegg feature effectively assigns permissions directly to a user, note that Descope attaches permissions to roles and never directly to users. The workaround is to create a Descope role containing exactly those permissions and assign that role to the user. Expect a small number of narrow, generated-looking roles as a result — that is the intended outcome, not a modeling smell.
| Frontegg | Descope |
|---|---|
| Feature linked to a permission | Permission |
| Feature gating UI only | Tenant custom attribute or role, read by the app |
| Plan assigned to an account | Tenant custom attribute (e.g. plan: "enterprise") or tenant roles |
| Plan expiration / time-bound plan | Tenant custom attribute with an expiry the app enforces |
| "Grant to all new accounts" | Flow step or tenant-creation default |
Advanced targeting on frontegg.* / custom / jwt.* attributes | Flow conditions on user/tenant attributes and JWT claims |
The commercial half — plan catalogs, trials, billing tiers — is not an identity concern and generally should not be recreated in Descope. Ask where it belongs: the billing system, the application's own database, or a dedicated entitlements vendor.
Effort: Medium, and highly variable. Establish scope before estimating.
Frontegg feature flags (up to 500 per environment, one flag per feature, with attribute-based targeting rules) are release-management tooling that happens to live in the identity dashboard. They are usually not part of an auth migration. If a flag is genuinely doing access control, map that specific case to Descope roles, permissions, or tenant attributes; general feature flagging should be treated as out of scope and moved to a dedicated tool. Do not present this as an SDK swap — flag it separately and ask whether it belongs in the identity migration at all.
Frontegg SSO is configured per account, typically by the customer's own admin through the self-service portal, with SAML 2.0 and OIDC support and JIT provisioning on first SSO login. Descope configures SSO per Tenant with the same capabilities.
Preferred approach — SSO Setup Suite: before migrating any SSO management code, ask whether the no-code SSO Setup Suite removes the need for it. It guides tenant admins through per-tenant SAML/OIDC setup with IdP-specific instructions (Okta, Microsoft Entra ID, Google Workspace, etc.). Frontegg customers are usually already used to self-serve SSO setup, so this maps directly onto an expectation their end customers already have.
| Frontegg | Descope |
|---|---|
| Account SSO configuration | Tenant SSO configuration |
| SAML 2.0 | Descope SAML SSO |
| OIDC | Descope OIDC SSO |
| Customer-admin SSO setup in the portal | SSO Setup Suite |
| SSO JIT provisioning | Tenant JIT provisioning / tenant association |
| SAML/OIDC prehooks for extra IdP attributes | Flow steps / attribute mapping / custom claims |
| SSO group → role mapping | SSO attribute / group-to-role mapping |
Frontegg as IdP (native-hosted, via-oidc, via-saml) | Federated Apps / Descope as IdP |
| Programmatic SSO management | Descope Management API / SDK |
Existing per-account SSO connections can be moved without making every customer admin reconfigure their IdP — Descope consumes the existing IdP response and completes authentication, so end users see no change. Follow SSO migration for the tenant setup, DNS redirect, and testing sequence.
If Frontegg was acting as an IdP for downstream applications, treat that as a separate workstream
from inbound SSO — it maps to Descope Federated Apps, and every downstream relying party needs its
issuer, metadata, and client credentials updated. Note the Frontegg caveat that OIDC-as-IdP requires a
default application in multi-app setups because aud verification depends on it; the equivalent
audience decision has to be made explicitly in Descope.
Effort: Medium — higher if Frontegg is an IdP as well as an SP.
Frontegg SCIM supports user and group create/update/deprovision and user↔group membership. Treat this as a continuing provisioning pipeline, not a one-time import — enterprise directories keep pushing events after cutover.
| Frontegg SCIM | Descope |
|---|---|
| SCIM configuration per account | Descope SCIM endpoint / token per tenant |
| User create/update/deactivate | Tenant user provisioning lifecycle |
| Group create/update/delete | External groups / group-to-role mapping |
| Group membership sync | Group-to-role mapping |
| Default role on SCIM creation, then SSO connection role, then SAML group roles | Tenant default role + SSO/SCIM group mapping |
managedBy: "frontegg" | "scim2" | "external" | Track provisioning source in the app or a custom attribute |
SCIM lifecycle webhooks (frontegg.scim.*) | Descope events, audit logs, webhooks, or app sync code |
One export-affecting quirk: Frontegg's docs acknowledge that changing a user's email at the IdP
creates a brand-new Frontegg user rather than updating the existing one. Long-lived SCIM tenants
therefore accumulate orphaned records. Expect duplicates in the export and plan a reconciliation pass
keyed on externalId before importing into Descope.
Effort: Medium–High — lifecycle, groups, deprovisioning, and role mapping are all subtle.
Frontegg prehooks are synchronous, blocking calls made before an event completes — either an API
call to the customer's service or custom code running on Frontegg's side. Each returns a verdict
(allow / block / challenge / lock), has a 5-second default timeout (configurable), and is configured fail-open or
fail-close. There is no single Descope equivalent; each prehook maps to a different Descope mechanism
depending on what it does.
| Frontegg prehook event | Descope approach |
|---|---|
AUTH_INITIATED | Flow entry conditions; the externalRedirectUrl pattern becomes a Flow branch or redirect action |
USER_SIGNUP | Flow step during sign-up (validation, enrichment, Connector call) |
USER_INVITE | Invitation Flow logic |
USER_UPDATE / USER_DELETE | Management SDK hooks in application code, or audit-event-driven sync |
CREATE_TENANT / UPDATE_TENANT / DELETE_TENANT | Application-side tenant lifecycle via the Management SDK |
JWT_GENERATION (custom claims, expiresIn, mfaFactorUsed rejection) | JWT Template and/or a Flow custom-claims action |
SOCIAL_LOGIN_AUTH / OIDC_AUTH / SAML_AUTH | Flow conditions on the authentication method, plus attribute mapping |
SEND_SMS | Messaging Connector / custom SMS Connector |
SIGN_UP_USER_POOL | See User Pools below |
Three things to pin down for each prehook: whether it blocks (a blocking prehook is a security
control, not an enrichment step), whether it is fail-open or fail-close (that determines what happens
when the equivalent Descope Connector times out), and whether it returns a tenantId — because a
prehook returning tenantId overrides Frontegg's default tenant resolution, which is the
documented way to do domain-based tenant assignment. That behavior must be rebuilt deliberately as
Flow logic or tenant self-provisioning domains, not inferred.
Effort: Medium–High — flag for dedicated review whenever a prehook blocks, challenges, or locks.
Frontegg ships nine built-in defenses, each with a configurable verdict. Descope has no single equivalent toggle; you reproduce the behavior with fingerprinting, risk signals, Flow conditions, and security Connectors.
| Frontegg security rule | Descope approach |
|---|---|
| Bot detection (allow / challenge / block / lock) | CAPTCHA / bot-detection Connector as a Flow step |
| New device (allow / challenge) | Fingerprinting + Flow condition on device recognition |
| Brute force protection (block / lock) | Lockout policy + Flow conditions |
| Breached password (allow / challenge / block) | Have I Been Pwned–style Connector in the password step |
| Impossible travel (allow / challenge / block) | Risk signals + Flow condition |
| Suspicious IPs (allow / challenge / block / lock) | IP reputation Connector (e.g. AbuseIPDB) + Flow branch |
| Stale users (allow / challenge / block) | Application-side policy or scheduled Management SDK job |
| Email credibility check (allow / block) | Email-validation Connector at sign-up |
| Country restrictions (allow / block) | Flow condition on geo signals |
MFA maps across three axes in Frontegg — policy (required or not), methods, and per-application enforcement with remember-device. In Descope, MFA lives inside the Flow: add an MFA step, branch on tenant or user attributes for per-customer policy, and use a subflow for enrollment. Note that Frontegg lets an account admin set a stricter policy than the environment (e.g. environment "Don't Force" → account "Force"); that per-tenant override needs to become an explicit Flow condition on a tenant attribute.
Ask whether each rule is monitoring-only or actually gates login. Effort: Medium–High only when verdicts affect production login outcomes.
Frontegg's step-up is standards-based, driven by acr (only one supported value:
http://schemas.openid.net/pape/policies/2007/06/multi-factor), amr (the method used), and
auth_time compared against max_age. AMR values map as: email OTP → [mfa, otp], SMS →
[mfa, sms], authenticator app → [mfa, otp], WebAuthn → [mfa, hwk].
| Frontegg | Descope |
|---|---|
acr_values request for step-up | Step-up Flow / re-authentication Flow |
max_age / auth_time freshness check | Flow condition on session age, or a fresh authentication requirement |
amr inspection after step-up | amr claim on the Descope session token |
unenrolledmfapolicy (ALLOW_SKIP / FORCE_ENROLL) | Flow branch for unenrolled users: skip, or enroll inline |
Embedded re-auth redirect to /account/re-authenticate?...&acr_values= | Step-up Flow route in the app |
Frontegg's refresh tokens do not carry amr/acr, so a step-up always forces re-authentication.
Confirm whether the application depends on that behavior before changing it, and check what the app
does when a user cancels — in Frontegg the JWT comes back with no acr_values claim, which
applications sometimes fail to handle.
Effort: Low–Medium.
Frontegg issues an access token plus a refresh cookie, with token templates and targeting rules configurable per token type, user, email, application, tenant, or role.
| Frontegg | Descope |
|---|---|
| Access token (JWT, RS256 or HS256) | Descope session JWT (DS cookie) |
fe_refresh browser cookie | DSR refresh cookie |
fe_session (Next.js stateless session cookie) | Managed by the Descope SDK; FRONTEGG_ENCRYPTION_PASSWORD goes away |
keepSessionAlive (refresh at ~80% of lifetime) | Descope SDK auto-refresh |
disableSilentRefresh / /silent endpoint | Not applicable — Descope handles refresh directly |
Refresh-token rotation (on by default; rotateRefreshTokens: false) | Descope refresh-token handling — confirm rotation behavior |
| Token expiration (environment-level setting) | Descope session/refresh token lifetimes |
| Token templates + targeting rules | JWT Templates |
aud = clientId or appId | Descope has no aud by default — configure explicitly if needed |
| JWKS / public key from the portal | Descope JWKS endpoint |
type, sid, applicationId claims | Not present by default — add via JWT Template only if the app reads them |
Effort: Medium — token differences ripple through middleware, API routes, and frontend hydration.
Frontegg's M2M model is two dimensions crossed: context (user tokens, which inherit the user's
roles on the active tenant and are deleted with the user; or tenant/account tokens, whose permissions
come from scopes granted at creation) and type (client-credentials tokens exchanged for a bearer
JWT and sent in Authorization, or access tokens used directly and sent in X-API-KEY).
That header split is the detail most often missed during migration: a service sending X-API-KEY
will not start working just because the token issuer changed.
| Frontegg M2M | Descope |
|---|---|
| Tenant (account) client-credentials token | Confidential Inbound App + Policy granting client_credentials access to a Resource's scopes |
Tenant access token (X-API-KEY) | Same as above, plus a client-side change to send Authorization: Bearer |
| User client-credentials / personal token | Access Key scoped to the user's tenant and roles, or an Inbound App if OAuth scopes are needed |
| Scopes granted at token creation | Resource scopes granted by Policy |
| Token audience | Resource identifier (aud) |
| Custom claims on M2M tokens | JWT Template |
| Secret shown once at creation, hashed thereafter | Same model — plan the rotation window |
| Up to 100 concurrent refresh tokens per client | Not applicable |
Default mapping: for scoped API access, use Resources + Inbound Apps + Policies. Use Access Keys only when the service needs a Descope-issued JWT without OAuth scope or audience enforcement — a simpler internal service-auth pattern.
Inventory every client, which header it uses, what scopes and audiences downstream services enforce, and the rotation plan. Note the Frontegg caps while inventorying — access tokens are limited per tenant and per environment, so a client count near those limits signals a token-sprawl problem worth fixing during the migration rather than reproducing. Effort: Medium — straightforward in design, careful in rollout.
Frontegg webhooks are configured per environment and signed with an x-webhook-secret header
verified as a JWT against the dashboard secret. Event keys are namespaced frontegg.* — for example
frontegg.user.created, frontegg.user.authenticated, frontegg.tenant.created,
frontegg.group.users.added, frontegg.scim.user.created.
| Frontegg | Descope |
|---|---|
Webhook endpoint + x-webhook-secret | Descope webhook / HTTP Connector + signature validation |
frontegg.user.* events | Descope user / audit events |
frontegg.tenant.* events | Tenant events or app-side lifecycle sync |
frontegg.group.* events | Group / role mapping events |
frontegg.scim.* events | Descope SCIM provisioning events |
Custom events (POST /event/resources/triggers/v3) | Application-owned events; not an identity concern |
| Static egress IP allowlisting | Confirm Descope's egress behavior with the customer's network team |
Two Frontegg-specific behaviors that change assumptions. Delivery semantics are unusual: a failed
event is never redelivered — the retry operates on the webhook, not the delivery, and after five
consecutive failures the webhook auto-disables with backoff up to about a week, then permanently.
Applications built against Frontegg may therefore have compensating reconciliation logic that can be
simplified. And for SCIM events, eventContext.userId is the literal constant "idp_provisioned"
with the real user under body.user — any handler doing that unwrapping needs rewriting, not
repointing.
Identify which handlers are business-critical before cutover. Effort: Medium.
Frontegg Flows are a no-code visual orchestrator composing webhooks, prehooks, and reusable sub-flows, with an NLP generator for authoring. Descope Flows are the same idea with a different execution model: rather than orchestrating external calls around the auth event, the Flow is the auth journey, with steps, conditions, actions, and Connectors inline.
Most Frontegg Flow use cases translate directly — conditional MFA, location-based terms acceptance, anomaly-triggered step-up, restricting sign-up origin, A/B testing across verification vendors. Map each Frontegg flow to a Descope Flow branch rather than to code. Where a Frontegg flow called an external service, that becomes a Descope Connector step.
Effort: Medium — usually a re-authoring exercise, not a rewrite.
Frontegg user pools let Frontegg sit in front of an existing user store rather than owning the
data. Two kinds: external pools (Auth0, Cognito, Firebase, or custom code, with sync-on-login or
JIT migration) and IdP federation pools (the IdP owns the data; no JIT, and no OTC, SSO, or SMS
login). Custom-code pools expose a Get User hook (getUserCodePayload, fired on SSO/passwordless/
social) and a Login hook (codePayload, fired on email+password).
This changes what "migrating users" means, so establish the actual state first:
tenantId resolution rule (derived from user properties, fixed value, or auto-create per user)? It applies only to new users, not retroactively, so historical tenant assignment may be inconsistent.Descope has no drop-in equivalent to user pools. The realistic targets are: migrate everything into Descope and retire the external store; or keep the external store and use Descope Flow steps with a Connector to validate against it during a transition period, which reproduces the custom-code Login hook pattern.
Effort: High — flag for dedicated review. The data-ownership question has to be settled before any code is written.
Frontegg AI provides identity for AI agents: agent definition in the dashboard, three built-in tools added automatically (get user context, get user tenants, get user entitlements), TypeScript and Python SDKs, and managed third-party OAuth integrations (Atlassian, GitHub, Google Workspace, HubSpot, Monday, Notion, Slack) with per-action scope selection using the customer's own provider credentials.
| Frontegg AI | Descope |
|---|---|
| Agent identity and credentials | Agentic Identity Hub agent identity |
| Agent acting with user context / session | Descope session + delegated access patterns |
| Built-in tools (user context, tenants, entitlements) | Session claims + Management SDK reads |
| Managed third-party OAuth integrations | Connections (Agentic Identity Hub's token vault for agent/MCP workloads), or Outbound Apps for non-agentic apps |
| Slack "on behalf of user" vs. "app-to-app" | Connection/Outbound App user-scoped vs. tenant/app-scoped token model |
| Per-action scope selection | Connection/Outbound App scope configuration |
| External clients calling your API on an agent's behalf | Resources (the MCP server) + Agentic Clients + Policies |
The strongest mapping here is Descope's third-party token vault — same problem (brokering and refreshing OAuth tokens for external SaaS APIs), same shape, but Descope has two objects that do this and picking the right one matters: Connections, under Agentic Identity Hub, is what Descope currently steers builders toward for agent and MCP workloads; Outbound Apps does the same job but is positioned for traditional (non-agentic) applications. Ask which kind of app this is before defaulting to Outbound Apps just because it existed first. The important caveat either way: stored third-party refresh tokens do not transfer. Every user re-consents per integration after cutover, so plan a re-consent path rather than a silent switch.
Frontegg does expose MCP in two places, so ask about both. The Entitlements Agent can be deployed
with an MCP Server that exposes authorization tools over HTTP (is-entitled-to-entity-action-tool
and entitlements-entities-tool), and Frontegg's separate AgentLink product (self-hosted
component: FrontMCP) ships a hosted or self-hosted MCP gateway for SaaS-facing use cases. If either
is in use, the migration target is Descope's MCP server support — an MCP server is modeled as a
Resource, with what the docs call Agentic Clients (Console: Agentic Identity Hub → Clients
— not Inbound Apps) registering which agents/clients may call it, governed by Policies — rather
than Outbound Apps or Connections. This is a different mapping
from the OAuth-brokering case above, and both AgentLink and Frontegg's Entitlements-Agent MCP server
are recent, fast-moving surfaces — verify current naming and capabilities against live docs before
committing to specifics in the plan.
Effort: Medium–High — flag for dedicated review.
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 Frontegg areas are:
Authorization vs. X-API-KEY, scopes, audiences, secret rotation.applicationId — Project vs. Federated App vs. Inbound App decision.Frontegg's access token carries a rich default claim set: sub, name, email, email_verified,
metadata, roles, permissions, tenantId, tenantIds, profilePictureUrl, sid, type,
applicationId, plus aud, iss, iat, exp. Descope session JWTs always carry sub, iss,
iat, exp, drn, and amr. The rest are conditional, each for a different reason:
tenants — present when the user has tenant associations and the JWT template uses the default authorization format. Other template formats put roles and permissions at the token root instead.dct — auto-set when the user belongs to exactly one tenant, or after tenant selection in a Flow. It is not gated on the template format.roles / permissions — can be project-level, in which case they appear with no tenant association at all.Descope tokens carry no email, name, or picture, so any code reading profile fields off the
token breaks after migration.
The tenant claims also change shape. Frontegg uses a flat tenantId (active) plus a tenantIds
array (membership). Descope uses dct (Descope Current Tenant — a flat string, the direct equivalent
of tenantId) and tenants, a keyed object ({ [tenantId]: { roles, permissions } }) holding
per-tenant roles and permissions. Prefer the SDK's helpers (e.g.
validateTenantRoles(authInfo, tenantId, [...])) over reading claims by hand; reach for dct when
you only need the active tenant ID.
Action required: Configure a JWT Template in the Descope Console to add email, name, and any
other fields the app reads — including anything a JWT_GENERATION prehook used to inject.
DS and DSRFrontegg stores its refresh token in the fe_refresh cookie, and the Next.js SDK adds a stateless
session cookie named by FRONTEGG_COOKIE_NAME (default fe_session), encrypted with
FRONTEGG_ENCRYPTION_PASSWORD. Descope collapses this into a signed session JWT in the DS
cookie with refresh in DSR, managed by the SDK. All three Frontegg environment variables go
away. Any code reading, writing, or clearing fe_refresh / fe_session must be replaced.
Frontegg refreshes at roughly 80% of JWT lifetime via /user/token/refresh (embedded) or
/oauth/token (hosted). Many Frontegg deployments added a custom domain specifically to avoid
third-party-cookie 401s on that refresh call. If the app has a Frontegg custom domain, find out
whether it exists for branding or for cookie reasons — the answer determines whether a Descope custom
domain is a nice-to-have or a launch blocker.
descopeClient.logout(refreshToken) to invalidate server-sideDS and DSR cookiesSkipping either step leaves a broken state. Note that Frontegg's hosted logout was a navigation
to {baseUrl}/oauth/logout?post_logout_redirect_uri=…, not a method call — so hosted-login apps
often have no logout code at all, just a link. That link must be replaced with real logout handling.
Frontegg tokens carry an aud claim (the client ID or app ID) by default, and backends — especially
.NET apps using AddJwtBearer with options.Audience — often validate it. Descope session tokens
have no aud claim by default. Apps relying on audience validation must (1) configure a custom
aud claim in a JWT Template and (2) pass audience to validateSession() on the backend.
Otherwise validation either fails or silently stops checking something it used to check.
Unless the cutover is a hard big-bang switch, there will be a window where some users hold Descope
session JWTs and others still hold Frontegg tokens. The backend must validate both during that
window: inspect the token's issuer or kid to determine which provider issued it, then validate
accordingly. Those unverified header/claim values only choose the verifier — each branch must verify
the signature against that provider's JWKS and pin the issuer (and audience where used) before any
claim is trusted. This is mandatory for either JIT migration path and strongly advisable for a phased full
migration. See Descope session migration —
note this specific doc is currently in beta, documented only for Auth0, Okta, or a custom-built
solution, and assumes the user already exists in Descope (it is not a JIT mechanism); confirm it still
applies before leaning on it, and fall back to hand-rolled dual validation (issuer/kid inspection) if
it doesn't cover a Frontegg-specific case. Plan the removal of the Frontegg branch as an explicit
follow-up task — dual validation left in place becomes a permanent second attack surface.
Frontegg's Next.js SDK supports inlining a single JWK as FRONTEGG_JWT_PUBLIC_KEY, and some backends
paste the public key from the portal rather than fetching JWKS. Grep for that pattern specifically:
it does not produce an import error after migration, it produces valid-looking code that rejects
every Descope token. Replace with the Descope SDK's validation or Descope's JWKS endpoint.
Most code referencing a Frontegg tenantId is management code — it becomes a Descope tenant ID
passed to management.tenant.* / management.user.* calls. Only request-time code that read the
account off the session changes shape: Descope exposes the active tenant as dct and membership as
the nested tenants object. Grep for all tenantId / tenantIds reads and sort them into these two
buckets — by-ID management calls vs. session reads — before updating.
On the web client, don't reach for the claim-reading helpers without checking their null-handling
first. @descope/web-js-sdk's getTenants(), getJwtRoles(), and getCurrentTenant() read the
tenants claim without guarding against it being absent — a user who belongs to no tenant yet (the
normal state right after signup) has no tenants claim at all, and getTenants() throws
(Cannot convert undefined or null to object) instead of returning []. A tenant-less user is a
valid, renderable state, not an error state — the migrated app needs to handle it. This was verified
in the browser client SDK specifically; if a backend SDK's equivalent helper is in play, check its
null-handling too rather than assuming the same behavior. Prefer useUser().userTenants for display
purposes (it's fetched fresh from the API — see the claim-freshness gotcha below) or guard the claim
read defensively (Object.keys(claims?.tenants ?? {})).
Frontegg's own docs note that role changes only apply once the current token expires, and recommend
shortening JWT lifetime to compensate. Descope behaves the same way, for the same reason — a
user's tenants, roles, permissions, and dct claims are set when the token is issued and do not
update themselves. Someone added to a tenant, or granted a new role, after their last sign-in holds a
token with the old claim set (or none at all) until they get a new one. This is easy to miss because
it's invisible in normal production use — JIT provisioning assigns the tenant before the first token
is ever issued — but very visible during migration testing, where tenants and roles get assigned by
hand in the Console against users who are already signed in from an earlier step. Symptoms show up as
several seemingly unrelated bugs ("no tenant" here, "no active tenant" there) before the shared cause
is obvious.
Apps migrating off Frontegg often already carry workarounds for this on the Frontegg side — forced refreshes after role assignment, artificially short token lifetimes, client-side role caches. Identify them and decide deliberately whether to keep them; don't assume Descope makes them unnecessary.
Two consequences for code, on the Descope side:
useUser() (or the equivalent
SDK call) returns tenant/role data fetched from the API, so Console changes show up on reload;
reading the same data out of the JWT gives you whatever was true at issue time.dct, call selectTenant() (client SDK) to
re-issue the token with the claim populated. Falling back to "just use the first tenant" in the UI
leaves the backend still seeing no active tenant, since the token itself never changed.widgetId With No Widget Behind It Fails as an Authorization ErrorEvery Widget referenced in code (e.g. <TenantProfile widgetId="...">) must correspond to a widget
actually provisioned in the Console for that project — referencing an ID that isn't provisioned fails
at runtime with "Unauthorized user: Operation not allowed for management request," which reads
like an RBAC problem and sends you chasing role and permission assignments that are actually fine.
If a widget call fails with that specific error, check whether the widget exists before touching
permissions. The SDK exports and types every widget component regardless of whether the backing
widget is provisioned in a given project, so TypeScript gives false confidence — a type existing is
not evidence the widget is live. Not all widgets ship provisioned by default; verify what's actually
in Console → Widgets for the project in hand rather than assuming the full catalog is present.
Outside Next.js — which ships authMiddleware in @descope/nextjs-sdk/server — Descope has no
drop-in auth-middleware package. Frontegg's withAuthentication(), FronteggSecurity(...),
frontegg.WithAuthentication(...), and @with_authentication(...) all
become roughly 20 lines of custom code that reads the DS cookie and calls validateSession(). Also
note the semantics: Frontegg's Go middleware treats Roles and Permissions as OR (at least one
must match). Do not assume the Descope helper you pick has the same semantics — verify it.
cookies() and headers() Are Async in Next.js 15cookies() and headers() from next/headers return a Promise in Next.js 15+. Before
generating any server-side helper that reads cookies:
package.json for the Next.js version.await cookies() and mark the containing function async.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.
Frontegg registers full callback URLs (http://localhost:3000/oauth/callback) and allowed origins
with wildcard support (https://*.acme.com). Descope uses Approved Domains (Console → Project
Settings → Security) — domain only, no protocol, no path. For local dev: localhost:3000, not
http://localhost:3000/oauth/callback. Confirm explicitly how any wildcard origin should be
represented rather than copying it across.
If SCIM is in use, re-point every SCIM connection at Descope before cutover. Also expect duplicate
user records in the export: Frontegg creates a new user when an IdP changes a user's email, so
long-lived SCIM tenants accumulate orphans. Reconcile on externalId before importing.
api.frontegg.com, Not the SubdomainDuring export work, management API calls must hit the regional gateway (api.frontegg.com for EU,
or api.us / api.au / api.ca), while tenant-context calls go to the environment subdomain or
custom domain. Getting this wrong produces {"errors":["Failed to verify vendor JWT"]}, which
Frontegg's troubleshooting docs attribute to misusing API contexts or directing requests to the wrong
gateway — it reads like a credential problem but is not. With an environment token on a self-service
route, add the frontegg-user-id and/or frontegg-tenant-id headers.
X-API-KEY vs. Authorization for M2MFrontegg client-credentials tokens go in Authorization; Frontegg access tokens go in X-API-KEY.
Any service using the latter needs a client-side change, not just a new credential. Inventory both
before cutover.
Frontegg's inbound migration supports carrying an authenticator secret into Frontegg — as an
authenticatorAppMfaSecret field on the migration API, or via the SIGN_UP_USER_POOL prehook, in
both cases Base32 — but there is no outbound equivalent, and passkeys are bound to the relying party
in any case. Users re-enroll their second factor after cutover. Communicate this before
the cutover date, not after.
Frontegg provides shared development OAuth credentials for every social provider except LinkedIn. An app whose Google login "just worked" may have no OAuth application of its own. Creating real credentials with each provider — including verification and consent-screen review where required — can take longer than the code change it accompanies.
Run the app and verify it works — don't just hand over a checklist.
grep -rni "frontegg" \
--include="*.ts" --include="*.tsx" --include="*.js" --include="*.jsx" \
--include="*.py" --include="*.go" --include="*.java" --include="*.kt" \
--include="*.cs" --include="*.swift" --include="*.dart" --include="*.gradle" \
--include="*.plist" --include="*.xml" --include="*.env*" --include="*.yml" \
--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, and manifests referencing Frontegg must be zero. Comments and migration
documentation that explain what a construct used to be (// Replaces Frontegg's handleSessionOnEdge) are expected and should stay — they're valuable, not stale. Pay particular
attention to non-source files — .env*, CI workflows, build.gradle, Frontegg.plist, and web-app
manifests (public/manifest.json-style files) — since none of these break compilation and are the
most commonly missed. A real migration commonly turns up a handful of hits that are all deliberate
comments alongside one or two real stragglers (an auto-update CI job pointed at Frontegg, a stale
manifest entry); read each hit rather than gating on the raw count.
npm install # or: pip install -r requirements.txt / go mod tidy
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 '@frontegg/...' → stale import; re-run Phase 0Property 'tenantId' does not exist on type '...' → wrapper built against Frontegg's flat user shape; re-derive from the Descope authInfo shape (dct / tenants)'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 mock or fixture still uses Frontegg's token shape; a test
asserts on claims that are now missing (email without a JWT Template, or tenantId where the code
now reads dct); or a test still stubs withAuthentication / FronteggSecurity.
# 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
curl -s http://localhost:<port>/login | grep -i "descope"
# Invalid token → 401
curl -s -H "Cookie: DS=invalid_token" http://localhost:<port>/api/me
# No Frontegg endpoints are still being called
curl -s http://localhost:<port>/ | grep -i "frontegg.com" && echo "STALE FRONTEGG REFERENCE"
echo "<DS_cookie_value>" | cut -d'.' -f2 | base64 -d 2>/dev/null | python3 -m json.tool
Check that email, name, and any other expected claims are present, and that dct / tenants
hold the tenant context the app used to read from tenantId / tenantIds.
## 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 component:** ✅
**JWT claims (email, name, dct):** ✅ Present / ❌ Missing — JWT Template not yet configured
**No residual Frontegg 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.
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, code-level diffs, Frontegg export patterns, and edge cases.references/flows-and-widgets.md — Descope terminology, Flows, Widgets, SSO Setup Suite, and the Console-vs-code decision guide.What SKILL.md sets; muted values are Claude Code's defaults
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.
/descope-authIntegrate Descope authentication into applications. Use when implementing login, signup, passwordless auth (OTP, Magic Link, Passkeys), OAuth, SSO, or MFA. Detects framework and provides targeted guidance./descope-byos-builderUse when building React "Bring Your Own Screen" (BYOS) custom UI on top of a Descope flow — reads the flow JSON (through the Descope MCP Server when connected, otherwise from Console exports), extracts the real screen names, interaction IDs and outputs, generates BYOS components that match hosted parity, and avoids the rediscovery-the-hard-way failure modes (silent form rejection, shared screen-name collisions, anonymous-session stickiness, nested-form hydration errors, wrong form keys, dead-end buttons, missing OAuth provider field)./descope-fga-schemaAuthor, edit, or apply a Descope FGA schema using the ReBAC/ABAC DSL. Use this skill whenever the user asks to create a new FGA schema, modify an existing one, add types/relations/permissions/conditions, review an authorization model, or apply schema changes to a Descope project. Trigger even if the user says things like "set up authorization", "define roles and permissions", "add team-based access", "make this endpoint check FGA", or "update my authz model" — these almost always mean an FGA schema change.Other plugins' skills for the same job