FusionAuth Migration Guide
Migration Skill Available
Want a faster, guided migration? The FusionAuth to Descope Migration Skill in descope/skills inventories the FusionAuth features and authentication touchpoints in your application, then produces a migration plan before making code changes.
This guide covers how to migrate your FusionAuth users, password hashes, tenants, and roles to Descope, and how to move the parts of FusionAuth that live outside the user store: hosted login pages, lambdas, identity providers, and backend token validation. It applies whether you run FusionAuth yourself or use FusionAuth Cloud.
You can migrate from FusionAuth to Descope in two main ways:
- Full Migration: You export users from the FusionAuth database, including their password hashes, import them into Descope, and then run only on Descope. Most users keep their password. (Most common)
- JIT Migration: Descope creates each user the first time that user signs in, after FusionAuth checks the password. Use it for users whose hash Descope cannot import, or instead of a bulk export.
You can combine either path with SSO migration for enterprise identity providers. Before you start, read the migration strategy page for the decisions every migration shares, such as cutover timing and which settings to recreate.
FusionAuth and Descope Terminology
Most FusionAuth objects have a Descope equivalent, but two of them work differently. A FusionAuth tenant is a separate user pool, while a Descope tenant is a group of users inside one project. And FusionAuth defines roles on each application, while Descope defines roles once for the whole project.
| FusionAuth Concept | Descope Equivalent | Description |
|---|---|---|
| Tenant | Project or Tenant | A tenant that holds an environment (for example, development or production) or a separate product maps to its own Descope project. A tenant that holds one of your B2B customers maps to a Descope Tenant. See Map Tenants. |
| Application | Project, Federated App, or Inbound App | Most apps have one FusionAuth application, which maps to the Descope project itself. Apps that keep a standard OIDC client map to a Federated App. Third-party API clients map to Inbound Apps. |
| User | User | FusionAuth emails are unique within a tenant. Descope login IDs are unique within a project. |
| Registration | Roles | Descope has no per-application registration. The roles on a registration become the user's Descope roles. |
| Application role | Role | Descope role names apply to the whole project, so rename or merge roles that share a name across applications. |
| Group | Roles | A FusionAuth group grants application roles to its members. Assign those roles to each member directly. |
user.data | Custom attributes | Each field your application reads becomes a Descope custom attribute. |
| Hosted login pages and themes | Flows and Styles | FusionAuth's hosted pages and FreeMarker themes map to a Descope Flow, which you can host on Descope or embed in your application. |
| Lambdas | JWT Templates, Flow actions, and Connectors | A JWT populate lambda maps to a JWT Template. Lambdas that validate a sign-in or call another service map to Flow conditions and connectors. |
| Identity providers | Tenant SSO and OAuth providers | Enterprise OIDC and SAML identity providers map to tenant SSO. Social providers map to OAuth providers. |
| Webhooks | Audit webhook and Connectors | Event consumers move to the audit webhook or a Flow connector. |
| Entities and grants | Inbound Apps or Access Keys | Machine-to-machine clients map to Inbound Apps or Access Keys. |
Self-service account management (/account) | Widgets | Profile, password, and MFA management map to the user profile Widget. |
Map Tenants
Decide what each FusionAuth tenant becomes before you export anything, because the decision changes how you import users.
- Tenants that hold environments or separate products: Create one Descope project for each tenant, and import each tenant's users into its project.
- Tenants that hold your B2B customers: Create one Descope tenant for each FusionAuth tenant, in a single project. FusionAuth lets the same email exist as two different users in two tenants. In Descope, those records become one user who belongs to both tenants. Before you merge them, see Users in More Than One Tenant.
Users in More Than One Tenant
FusionAuth tenants are separate user pools, so anyone can register an email address in a tenant without proving they own it. When you merge two records into one Descope user, the record you keep supplies the password, MFA, and profile. If that record was created by someone who does not own the email, merging it gives that person access to the real user's account.
Use these rules when you merge records that share an email:
- Merge automatically only when every record has a verified email and the same active status. Keep the password, profile, and TOTP secret from one record, such as the record with the most recent sign-in. Add a tenant membership for each record, with that tenant's roles.
- Review every other duplicate by hand. Do not import an email automatically if any of its records is unverified, or if the records differ in active or locked status. A Descope user's disabled status applies to the whole project, so it cannot show that a user is inactive in one tenant and active in another. Decide for each user whether to leave out the membership in the inactive tenant or to disable the user.
- Or keep the tenants apart. If many duplicates conflict, map those FusionAuth tenants to separate Descope projects instead of tenants in one project.
Full Migration
In a full migration, you copy your FusionAuth data into Descope and then switch your application to Descope.
Descope must create objects in dependency order, because a user cannot reference a tenant or role that does not exist yet. The order is tenants, then permissions, then roles, then users.
Let an AI agent write the migration script
An AI agent connected to the Descope MCP Server can write the export and import
scripts for your FusionAuth setup, mapped to your own tenants, roles, and user.data fields. The
migration skill includes the queries and
mappings in this guide.
Prerequisites
You need access to both systems before you export anything.
- FusionAuth database: The FusionAuth API never returns password hashes. To migrate passwords, you need the data from
the FusionAuth database.
- Self-hosted FusionAuth: You need read access to your FusionAuth database (PostgreSQL or MySQL).
- FusionAuth Cloud: Open a support ticket with FusionAuth for a database export. FusionAuth provides it as a PostgreSQL dump, which you restore locally. Request it early, because it can take time.
- FusionAuth API key: You need an API key that can read tenants, applications, groups, identity providers, and
lambdas. FusionAuth expects the key itself in the
Authorizationheader, without aBearerprefix. - Descope: You need your Project ID and a Management Key.
The export contains password hashes
Store the database export encrypted, keep it out of source control, and delete it after you verify the production import.
1. Export Data from FusionAuth
Export configuration through the FusionAuth API, and export users from the database. See the FusionAuth API reference and FusionAuth's export guide for the full details.
# The FusionAuth API key goes in the Authorization header as it is, without "Bearer".
# Add X-FusionAuth-TenantId when your instance has more than one tenant and the call is tenant-specific.
curl "https://<your-fusionauth-host>/api/application" \
-H "Authorization: <FUSIONAUTH_API_KEY>"| Data | Source | Notes |
|---|---|---|
| Tenants | GET /api/tenant | Includes each tenant's password, MFA, and token settings. |
| Applications and roles | GET /api/application | Each application lists its own roles. |
| Groups | GET /api/group | Each group lists the application roles it grants. |
| Identity providers | GET /api/identity-provider | Needed for SSO migration and social providers. |
| Lambdas | GET /api/lambda | Includes the source code of each lambda. |
| Users and password hashes | FusionAuth database | In current FusionAuth versions, the hash is in the identities table, joined to users. |
| Registrations and roles | FusionAuth database | The user_registrations and user_registrations_application_roles tables. |
| Group memberships | FusionAuth database | The group_members and group_application_roles tables. |
This query, from FusionAuth's export guide, returns each user with the fields Descope needs to import the password:
SELECT u.id, u.first_name, u.last_name, i.email, i.verified,
i.encryption_scheme, i.password, i.salt, i.factor
FROM identities i
JOIN users u ON u.id = i.users_id;FusionAuth changes its database schema between versions, so check the schema for your version before you run any
query. Before you plan the import, count your users by encryption_scheme, which is the hashing algorithm. The count
tells you how many users can keep their password through the import, and how many need JIT migration.
Exporting users through the API
If you do not need password hashes, you can read user profiles with the FusionAuth user search API
(POST /api/user/search). On the Elasticsearch search engine, FusionAuth versions earlier than 1.48.0 return at most
10,000 users from a search. Compare your exported count with the total number of users before you import.
2. Map FusionAuth Data to Descope
Each FusionAuth object maps to a Descope object that the Management API can create.
| FusionAuth field | Descope field | Notes |
|---|---|---|
email | loginId and email | If your users sign in with a username, use the username as the login ID. |
verified | verifiedEmail | Set only for users whose email FusionAuth marked as verified. |
first_name, middle_name, last_name | givenName, middleName, familyName | |
full_name | name | |
mobile_phone | phone | Descope requires E.164 format. Drop or fix numbers that do not match. |
image_url | picture | |
| Tenant (for customer tenants) | userTenants[].tenantId | Create the tenants first, and use the FusionAuth tenant ID as the Descope tenant ID. |
| Registration roles and group roles | roleNames, or userTenants[].roleNames | A group's roles apply only to applications the user is registered for. |
active set to false | status: "disabled" | |
id and data fields | Custom attributes | Keep the FusionAuth id so you can trace each user, and so your own tables can still find the user. |
insert_instant | createdTime | Convert milliseconds to seconds. See Preserving Creation Dates. |
Define each custom attribute in Descope before the import. If some users
need JIT migration, also define a freshlyMigrated custom attribute and set it to true on those users.
Password Hashes
FusionAuth stores the hash and salt as base64 values, and stores the iteration count in factor. Map each user's
encryption_scheme to a Descope hashed password format:
FusionAuth encryption_scheme | Descope hashedPassword | Notes |
|---|---|---|
salted-pbkdf2-hmac-sha256 | pbkdf2 with type set to sha256 | FusionAuth's default. Set iterations to the user's factor. |
salted-pbkdf2-hmac-sha512-512 | pbkdf2 with type set to sha512 | Set iterations to the user's factor. |
salted-pbkdf2-hmac-sha256-512 | pbkdf2 with type set to sha256 | This scheme derives a 512-bit key. Test with a known password before you import all users. |
bcrypt | bcrypt | FusionAuth stores the bcrypt salt and hash in separate columns, in bcrypt's own encoding rather than standard base64. Combine them as they are into one bcrypt string, $2a$<cost>$<salt><hash>, where the cost is the user's factor padded to two digits, such as 08 or 10. Test with a known password before you import all users. |
phpass-md5, phpass-sha512 | phpass | Test with a known password before you import all users. |
salted-sha256 | sha with type set to sha2-256, only when factor is 1 | Not yet verified. FusionAuth hashes the password followed by the salt, so leave saltPosition at its default, suffix. FusionAuth repeats the hash factor times, while the Descope sha format hashes once, so users with a factor above 1 cannot be imported this way. Test with a known password before you import all users, including whether Descope expects the salt base64-encoded or decoded. |
salted-md5, salted-hmac-sha256 | Not supported | Import these users without a password, and use JIT migration or a password reset. |
"hashedPassword": {
"pbkdf2": {
"hash": "<password column, base64>",
"salt": "<salt column, base64>",
"iterations": 24000,
"type": "sha256"
}
}To test a hashing scheme, create a test user in FusionAuth with a password you know, import that user into a development project, and sign in. Do not use a real user's password for the test.
If your users use an authenticator app for MFA, you can import their secrets too. See Importing TOTP Secrets. Descope expects a base32 secret, so convert the value if your export stores it in another encoding. Passkeys cannot be migrated, because they are bound to FusionAuth's domain. Users with passkeys enroll again after the cutover.
3. Import into Descope
Descope can create users one at a time with Create User, or in groups with Batch Create Users. For a large user base, use the batch endpoint and follow the user management rate limits. The field names in the mapping table match the Batch Create Users API reference. The user JSON formatting guide uses different field names and applies only to Console imports.
Run the import against a development project first. Sign in as a test user for each hashing scheme in your data, and compare the record counts with your FusionAuth export. Then repeat the import against your production project.
4. Cut Over
Users who imported with a password hash can sign in with Descope on the first day. To switch your application:
- Run the production import.
- Apply every change made in FusionAuth after your export, as described in Reconcile Changes Since the Export.
- Switch your application from FusionAuth to Descope.
Reconcile Changes Since the Export
Changes that admins and users make in FusionAuth between your export and the switch must also reach Descope. This
includes removed access, not only new users. Filtering users by insert_instant and last_update_instant finds new and
updated users, but misses three kinds of change:
- Deleted users: A deleted user has no row left to find.
- Role and membership changes: Registrations, group memberships, and group roles live in other tables, with their own timestamps.
- Deactivated or locked users: These changes might not update the timestamp you filter on.
If you miss these changes, a user who lost access in FusionAuth keeps it in Descope. Use one of these approaches:
- Compare the final state (recommended): Run the export again right before the switch, and compare it with what you imported, matched by the FusionAuth user ID. Delete users that no longer exist in FusionAuth, update each user's active status, replace each user's roles and tenant memberships with the current ones, and update changed passwords.
- Freeze FusionAuth: Stop all changes in FusionAuth, including sign-ups and admin changes, from your final export until reconciling is done and you have switched. Freezing only sign-ups is not enough.
A user merged from several FusionAuth tenants has one Descope record but one FusionAuth user ID per tenant. Keep a record of every merged ID and its tenant during the import, and reconcile each tenant membership on its own. A record deleted or deactivated in one tenant should then remove only that membership, not the whole user.
If some users could not import with a password, add the Generic HTTP Connector to your sign-in Flow before the switch, and keep FusionAuth running for a transition period. During the transition, the Flow checks those users' passwords with FusionAuth. To keep passwords for most active users, we recommend keeping FusionAuth on for at least a few months.
A few changes still need a plan:
- Existing FusionAuth sessions: Users with an active FusionAuth session sign in again after the switch, unless your backend accepts both tokens for a period, as described in Session Validation Strategy.
- Applications that use a standard OIDC library: Apps that connect to FusionAuth through an OIDC library, such as NextAuth, Spring Security, or ASP.NET, can keep the library and connect it to Descope through an OIDC Federated App. Use the app's own client ID, not your Project ID. Server-side apps use a Confidential app with its client secret. Single-page and mobile apps use a Public app with PKCE and no client secret, because anyone can read a secret stored in a browser or mobile app. Apps that use the FusionAuth React, Vue, or Angular SDK move to the matching Descope SDK.
- Older mobile app versions: An app version that still connects to FusionAuth keeps sending users to FusionAuth until they update.
JIT Migration
Note
For JIT migration, keep FusionAuth running for the transition period you choose. To keep passwords for most active users, we recommend at least a few months.
With Just-In-Time (JIT) migration, Descope creates or updates each user when that user signs in, so the migration happens gradually and without downtime. You can use it on its own, or only for the users whose password hash Descope cannot import.
Using the Generic HTTP Connector
Use this approach to keep passwords working. On first sign-in, your Flow sends the user's login ID and password to FusionAuth, and FusionAuth checks them.
- The user enters an email and password in your Descope Flow.
- A Generic HTTP Connector calls the FusionAuth
Login API (
POST /api/login) withloginId,password, andapplicationId. Use a FusionAuth API key that can call only this endpoint, and anhttps://URL, because the request carries the user's password. - If FusionAuth accepts the credentials, the Flow stores the password in Descope and starts a Descope session.
- On later sign-ins, Descope checks the password itself, and FusionAuth is not involved.
The action that stores the password depends on whether the user already exists in Descope:
- Users who are not in Descope yet: The Sign Up / Password action creates the user with that password.
- Imported users without a password (
freshlyMigrated): The Sign Up / Password action fails, because the user already exists. The Flow signs the user in with OTP or magic link instead, stores the password with the Update Password action, and clearsfreshlyMigrated.
The FusionAuth Login API returns 200 when sign-in succeeds. Only a 200 response should lead the Flow to store the
password and start a Descope session.
FusionAuth returns other codes when the password is correct but FusionAuth refused the sign-in on purpose. After the Flow stores a password, later sign-ins no longer reach FusionAuth, so treating one of these codes as success would remove the restriction permanently. Route each code to its own branch:
| Login API response | Meaning | Flow branch |
|---|---|---|
200 | Sign-in succeeded | Store the password and start the Descope session. |
202 | The user is not registered for the application | Deny the sign-in. |
203 | The user must change their password | Send the user to a password reset. Do not store the old password. |
212, 213 | The email or registration is not verified | Verify the email with OTP or magic link before storing the password or starting a session. |
242 | MFA is required | Store the password only after the user proves the factor they enrolled in FusionAuth. The Flow can verify a TOTP secret you imported for that user, or complete FusionAuth's MFA step with the returned twoFactorId. This branch should never let the user enroll a new factor. Otherwise, deny the sign-in. |
404 | The user does not exist, or the password is wrong | Deny the sign-in. |
Any other code, a timeout, or a 5xx error | Unknown | Deny the sign-in. |
For the full list of codes, see the Login API reference.
Using FusionAuth as a Custom OIDC Provider
Use this approach if you are moving users to passwordless sign-in, or if a password reset on first sign-in is acceptable. Users sign in through FusionAuth's hosted login once, and Descope creates them from the returned ID token.
- Add FusionAuth as a custom OAuth provider
in Descope. Use the client ID and client secret of a FusionAuth application, and the endpoints from your tenant's
OpenID configuration (
/.well-known/openid-configuration/<tenantId>). - Add a Sign Up or In / OAuth action to your Flow that sends users to FusionAuth.
- Map the ID token claims to Descope user attributes. Descope creates the user and starts a Descope session.
After Descope has created a user, a condition in your Flow can route that user to Descope-native sign-in, such as passkeys or magic link, so the user no longer goes through FusionAuth.
SSO Migration
If your customers sign in through enterprise OIDC or SAML identity providers in FusionAuth, you can move each one to the matching Descope tenant so customer admins do not have to set up their IdP again. For the full process, including tenant setup, DNS redirect, and testing, see SSO Migration.
The FusionAuth identity providers API (GET /api/identity-provider) returns most of what each Descope tenant needs:
- SAML: The IdP's SSO URL, its signing certificate, and the claim mappings. FusionAuth stores the certificate as a
key, which you can read with
GET /api/key/<keyId>. - OIDC: The issuer or endpoints, the client ID, and the client secret.
- Managed domains: The email domains that route users to each IdP. Add them to the Descope tenant's email domains.
If a FusionAuth reconcile lambda maps IdP claims to roles or user data, recreate that mapping in the tenant's SSO settings.
Lambdas and Custom Claims
FusionAuth lambdas run at fixed points in sign-in and sign-up. Read the source of each lambda from
GET /api/lambda before you recreate it in Descope.
| FusionAuth lambda | Descope approach |
|---|---|
| JWT populate, Id Token populate, and UserInfo populate | A JWT Template that adds the same claims, or a custom claims action in the Flow |
| OIDC and SAML reconcile | Attribute and role mapping in the tenant's SSO settings |
| Social provider reconcile | Attribute mapping on the OAuth provider |
| Login validation | A condition or connector after authentication in the Flow |
| Self-service registration validation | A condition or connector before the Flow creates the user |
Session Validation Strategy
Whether you choose a full migration or a JIT migration, some users will still have FusionAuth sessions after you start issuing Descope sessions. Your backend should accept both token types during the transition:
- Descope session tokens: Validate these for users who already signed in through Descope.
- FusionAuth tokens: Validate these for users who still have an active FusionAuth session.
Your backend can read the unverified iss claim to choose a validator. Each validator must then check the token
signature against that provider's keys before your backend trusts any claim, because the iss claim alone is not
proof of where a token came from. For the pattern, see
dual token validation.
Check how your backend validates FusionAuth tokens
FusionAuth can sign tokens with an HMAC key, which backends check with a shared secret instead of a public key. FusionAuth installs that were set up with Kickstart, or before version 1.50.0, use HMAC keys by default. A backend that checks tokens with a shared secret rejects every Descope token, so replace that check with Descope session validation.
Descope tokens carry different claims than FusionAuth tokens:
- User ID: The
subclaim holds the Descope user ID, not the FusionAuth user ID. If your own tables store FusionAuth user IDs, look users up by the custom attribute that holds the FusionAuthid, or update those tables. - Profile claims: Descope tokens do not include
emailorpreferred_usernameby default. Add them with a JWT Template. - Audience: FusionAuth sets
audto the application ID, and many backends check it. Keep an audience check, but point it at a value that only this app's tokens carry. Descope tokens include your project ID inaudby default, and every app in the project gets the same value, so a check for the project ID alone accepts tokens from any app. Tokens from an OIDC Federated App can include the app's client ID, which your backend can check. Session tokens from the Descope SDKs share one project-wide JWT Template, so anaudadded there does not tell apps apart. - Tenant: Code that reads the
tidclaim should readdct(the current tenant) ortenantsfrom a Descope token.
Post-Migration Verification
After the cutover, check that the data, sign-in, and authorization behave as they did in FusionAuth.
- Compare FusionAuth user counts with Descope user counts, and resolve every failed record.
- Sign in with a test user for each hashing scheme you imported.
- Confirm that users from more than one FusionAuth tenant have every expected tenant membership and role, and that every duplicate you set aside for review has been resolved.
- Confirm that users deleted, deactivated, or removed from a role in FusionAuth after your export have the same status in Descope.
- Confirm that every inactive FusionAuth user is disabled in Descope or, for a user merged across tenants, has no membership in the tenant where they were inactive.
- Confirm that each user's roles match their FusionAuth registration roles and group roles.
- Test every sign-in method, including the JIT path for
freshlyMigratedusers. - Test every migrated identity provider with a real sign-in from the customer's IdP.
- Confirm that your APIs reject expired, invalid, and wrong-issuer tokens.
- Search your code and configuration for leftover FusionAuth SDK imports,
FUSIONAUTH_*environment variables, and FusionAuth claim names. - Delete the FusionAuth database export.
For the settings that sit around your users, such as password policy, email providers, and audit streaming, see the migration strategy page.