Move a React app from Auth0
udibo/migrate-from-auth0-react
is a public repository that moves one application from Auth0 to Udibo, one
tagged commit at a time. It starts from Auth0's own React single-page sample: a
React app that signs in with @auth0/auth0-react and calls an Express API that
checks Auth0 access tokens. The links below show the application changes and
the tests that cover them.
The move has two phases, and you can stop between them:
Phase A: change the library, keep Auth0. The app takes
@udibo/oauth2while it still signs in through your Auth0 tenant. No user, client or Auth0 setting changes.Phase B: change the issuer, then move the users. Three configuration values point the app at a Udibo tenant. The users follow by import, with or without their passwords.
This page is the walkthrough for that one app. For the decisions every migration needs, such as identity mapping, rehearsal and rollback, read Move an existing application first.
| Tag | What changes | Evidence |
|---|---|---|
step-0-upstream | Auth0's sample signs in through Auth0. | React entry point |
step-1-udibo-package | The app uses @udibo/oauth2 and still signs in through Auth0. | Client and API changes |
step-2-udibo-idp | The same app signs in through a Udibo tenant. | Browser test changes |
step-3-user-import | The converter prepares user records for import without passwords. | Export and conversion changes |
step-4-password-migration | The converter marks eligible accounts for a password check against Auth0 at first sign-in. | Import-record tests |
Before you start
Node.js 22.12 or later. The repository's tests run on Node.js 22 and 24.
A clone of the repository, checked out at the tag for the step you are reading.
No tenant, to read the diffs and run the default tests. From
step-1-udibo-packageon, the browser tests sign in through the package's local identity provider, which the test run starts itself.A tenant, to sign in through a real one. The repository's README lists the Auth0 and Udibo settings its own test tenants use, under Set up the Auth0 tenant and Set up the Udibo tenant. Use tenants that hold made-up users only. The site at udibo.com says how to get a Udibo account.
Install the dependencies and run the tests that need no tenant:
npm ci
npm test
npm run test:behavior
npx playwright install --with-deps chromium
npm run test:e2enpm test is the sample's own component tests. npm run test:behavior builds
the app and tests the app server and the API as separate processes; from step 3
on it also tests the export and import-record scripts. npm run test:e2e signs
in through Chromium. At step-0-upstream that last command needs an Auth0
tenant, because Auth0's SDK cannot sign in through the local identity provider.
Phase A: adopt @udibo/oauth2 while still signing in through Auth0
Step 1 replaces @auth0/auth0-react with @udibo/oauth2 0.51.0 and changes
nothing at Auth0. It is worth doing by itself: once the app runs on a
standards-based client, moving to another issuer is configuration.
What changed in the app
| File | Before | After |
|---|---|---|
package.json | @auth0/auth0-react | @udibo/oauth2; every dependency pinned to an exact version and upgraded, React Router from 6 to 7 |
src/auth.js (new) | None | Creates a DirectClient: a public client with no secret, PKCE, and the app's origin as the redirect URI |
src/index.jsx | <Auth0Provider domain clientId authorizationParams> | <OAuth2Provider client> |
src/App.jsx | The SDK completes the sign-in on whichever page Auth0 returns to | The home route renders <OAuth2Callback> when the URL carries state with code or error |
src/components/NavBar.jsx | useAuth0(), loginWithRedirect(), logout({ logoutParams }) | useOAuth2(), login(), logout({ returnTo }) |
src/views/Profile.jsx | withAuthenticationRequired(Component) | <RequireAuth fallback={<Loading />}> around the component |
src/views/ExternalApi.jsx | getAccessTokenSilently(), and pop-ups to sign in or consent again | useDirectClient() and client.getAccessToken(); signing in or consenting again is a redirect |
src/config.js, vite.config.js, .env.example | AUTH0_DOMAIN, AUTH0_CLIENT_ID, AUTH0_AUDIENCE | OAUTH_ISSUER, OAUTH_CLIENT_ID, OAUTH_AUDIENCE |
api-server.js | Builds the issuer from AUTH0_DOMAIN | Reads the issuer URL from OAUTH_ISSUER; still checks tokens with express-oauth2-jwt-bearer |
For Auth0, OAUTH_ISSUER is https://<your tenant's domain>/, with the
trailing slash, exactly as the tenant's discovery document names it.
The package's React guide documents the provider, hooks and components the diff uses.
What stays specific to Auth0
The
audiencesign-in parameter. The sample's API accepts only an access token issued for its own audience, and the sample asks Auth0 for it in the sign-in request (Auth0's access token reference, read on 2026-11-29, says to check that a failing token "was issued with your custom API as theaudience").DirectClienthas no option for a default sign-in parameter, sosrc/auth.jssubclasses it to addaudienceto every sign-in (udibo/oauth2#189 tracks the option). The browser tests check that the parameter is sent.The API's token check. The API stays on
express-oauth2-jwt-bearerthrough every step. It only needed the issuer as a full URL.The Auth0 dashboard settings, which are unchanged. The repository's README lists the ones the app depends on, under What Auth0 still needs to be configured with. That list is what Phase B has to replace.
What your users notice
The repository's README records each of these under Behaviour that changes:
A page reload starts signed out. The client keeps tokens in memory and the sample requests no refresh token, so a reload has nothing to resume from. A protected page starts a new sign-in, which the provider completes without asking for the password while its own session lasts.
Pop-up sign-in becomes a redirect.
@udibo/oauth2has no pop-up flow. The API page's two recoveries, signing in again and consenting again, send the browser to the provider and return to the same page.An expired access token needs a new sign-in, for the same reason as the reload.
If a reload must keep the session, plan a backend that holds the tokens before you start: see choose the client type. The example keeps the browser-only shape so that each diff stays small.
Check it against your Auth0 tenant
E2E_PROVIDER=auth0 npm run test:e2eThis runs the same browser tests through a real Auth0 tenant. It reads
AUTH0_DOMAIN, AUTH0_CLIENT_ID, AUTH0_AUDIENCE, AUTH0_TEST_USERNAME and
AUTH0_TEST_PASSWORD from the environment or an untracked .env.local, and
refuses to start without them. The tests are step 0's, adapted at step 1 to the
new client: the sign-in request no longer carries nonce or response_mode,
which the README lists under Behaviour that changes. A pass means sign-in,
the profile, the API call and sign-out still work against your tenant, with the
changes that section lists.
You can release Phase A and stop here. Nothing in it depends on Udibo's hosted service.
Phase B: switch to a Udibo tenant
No file under src/ changes, and neither does api-server.js. The diff is
the .env.example comment, the browser tests' description of the Udibo
sign-in page, the scheduled workflow and the README. In your clone,
git diff step-1-udibo-package step-2-udibo-idp -- src/ api-server.js
prints nothing. The move is three values:
| Setting | At Auth0 | At Udibo |
|---|---|---|
OAUTH_ISSUER | https://<your tenant's domain>/ | Your tenant's issuer, such as https://{tenant-id}.udibo.com, with no trailing slash |
OAUTH_CLIENT_ID | The Auth0 application's client ID | The Udibo application's client ID |
OAUTH_AUDIENCE | The Auth0 API's identifier | The audience set on the Udibo application |
Register the application in Udibo
Udibo does not import another provider's client IDs or secrets, so the app gets a new registration. In your tenant's dashboard, create an application like the example's:
Public, with no client secret, because the code runs in the browser. See sign in from a browser-only app for which pages may call the token endpoint.
First-party, so your own app shows no consent screen.
The authorization code grant.
The app's origin as both the redirect URI and the post-logout redirect URI, matched exactly. The example registers
http://localhost:3000on a Development application; see register where sign-out returns.JWT access tokens with your API's audience. See choose how your API validates tokens.
Get started shows where the issuer and client ID appear.
What differs from Auth0
The audience belongs to the application. Udibo takes an access token's audience from the application's own setting, not from a sign-in parameter, and there is no separate API object to authorize the application for. The client still sends
audience; it no longer decides anything.Cross-origin calls need no separate setting. Registering the redirect URI on a public application is what lets that page call the token endpoint.
The API keeps working unchanged. In the example,
express-oauth2-jwt-bearerchecks Udibo's access tokens against the new issuer's keys as it checked Auth0's.A user without an email has no
emailclaim. The example's Udibo test user signs in with a username, so the sample's profile heading, which showsemail, is empty for that user. Check which claims your own pages read.
Check it against your Udibo tenant
E2E_PROVIDER=udibo npm run test:e2eIt reads UDIBO_ISSUER, UDIBO_CLIENT_ID, UDIBO_AUDIENCE,
UDIBO_TEST_USERNAME and UDIBO_TEST_PASSWORD the same way. Keep running the
Auth0 command beside it while you move: the same code, configured for Auth0,
still signing in is your rollback by configuration.
Move your clients one at a time
A new registration means each client changes its configuration, so plan the order instead of one switch:
Register every client again in Udibo. Each app, API caller and machine client gets a new client ID, and a confidential one a new secret.
Have your APIs accept tokens from both issuers while clients move. Validate each token against its own issuer, keys and audience, as connect a test application first requires. With
express-oauth2-jwt-bearer, which checks one issuer, the example's README suggests one middleware per issuer, or a second instance of the API for the Udibo clients. If you use two checks in one API, run the second whenever the first rejects the token or cannot load its issuer's keys, so the other issuer's valid tokens still work. The example has one client and does not test a two-issuer cutover.Move clients one at a time, each by its three settings.
Turn Auth0 off last, once the final client has moved and the tokens Auth0 issued to it have expired. If you take step 4 below, Auth0 stays up until the end date you set there.
Until the users are imported, a person with only an Auth0 account cannot sign in through Udibo. Import a test cohort before you move the first client that real people use. A third-party application asks its users for consent again, and sessions do not carry across: everyone signs in once after the move.
Move the users
You choose one of two imports before anything is imported. An import skips an account that already exists, so an account imported without step 4's marker cannot be given it by importing again.
| Step 3: import without passwords | Step 4: check passwords against Auth0 once | |
|---|---|---|
| First sign-in | By emailed code or link, or by setting a password with "Forgot password?" | With the person's Auth0 password |
| Needs from Auth0 | A profile export | A profile export, and a dedicated Auth0 application that stays up until your end date |
| What Udibo sends out | Nothing | Each pending user's password to Auth0, at that user's sign-in |
| Tested in the example | The export and conversion scripts, by automated tests with synthetic records; one real export and one import rehearsed by hand on a local Udibo | The import records only |
If you hold password hashes in a
format the import accepts,
a third way is to add them to the records as legacyCredential. The example
does not: Auth0's documentation, read on 2026-11-29, releases hashes only
through a support request that "is not available for our Free subscription
tier"
(Export Data),
with an eligibility review, a signed acknowledgment form and a PGP key
(Export Password Hashes and MFA Secrets).
The example's tenant is on that plan. Read those pages for your own plan.
Step 3: import the users without passwords
The app does not change. The step adds three scripts and a shared file-writing module under scripts/, their
tests in test/export-auth0.behavior.mjs, and two package.json commands.
Export the users from Auth0:
npm run export:auth0 -- auth0-users.ndjsonThe script signs in as an Auth0 machine-to-machine application authorized for
the Auth0 Management API with read:users alone, and reads AUTH0_DOMAIN,
AUTH0_EXPORT_CLIENT_ID and AUTH0_EXPORT_CLIENT_SECRET. It asks Auth0 for a
user export job and downloads the result. It writes the file with owner-only
permissions, refuses to overwrite one, and prints no record. The file holds
every user's email address and profile; git ignores *.ndjson.
Turn the export into Udibo import records:
npm run auth0-to-udibo -- auth0-users.ndjson udibo-import.ndjsonThe converter at step 3 writes the import file format with this mapping:
| Auth0 | Import record |
|---|---|
email, email_verified | email, emailVerified |
nickname, given_name, family_name, name | username, firstName, lastName, displayName |
Social identities[] from google-oauth2, github or apple | identities[] with provider google, github or apple, and the identity's user_id as subject |
app_metadata, user_metadata | metadata, userMetadata |
Read the command's report before you send the file:
No record carries a password. A hash a record does carry is dropped and counted.
Other social identities are left out and counted. A user whose only sign-in was one of those signs in by email instead.
usernamecomes from Auth0'snickname. The import skips a record whose supplied username is already taken, so look for users who share a nickname before you send the file. In the example's export each user's nickname was the local part of their email address.A user blocked in Auth0 is still written, and imports as a working account. Remove those records if they should not have one.
Have the file imported. Udibo runs the import for you: you agree a secure channel, send the file, and ask for a dry run first, as Udibo runs the import for you describes. Your own deployment cannot call it. Rehearse with a small cohort and reconcile the imported, skipped and error counts.
Tell people how their first sign-in works. An account imported this way has no password. Its owner signs in with an emailed code or link, when your tenant offers email sign-in, or sets a password through "Forgot password?". Both need the person to still read that inbox. Second factors and passkeys do not come across; people enroll again.
Step 4 (optional): keep the passwords
Step 4 takes the place of step 3's import. Each eligible database user from
the selected Auth0 connection is imported with
a remotePassword that names their Auth0 account, and your Udibo tenant
registers the Auth0 tenant as its password migration source. The first time
that person signs in at Udibo with their old password, Udibo checks it against
Auth0 once, then stores it in its own format.
Password migration at sign-in
is the reference for all of it, including
what it costs.
The example has not run this step end to end. Its tests cover which
records get a remotePassword. Connecting the source and an imported user's
first sign-in were not run through the example's tenants, which its README
states under What was tested.
The diff changes scripts/auth0-to-udibo.mjs and its tests. The same command
takes one flag:
npm run auth0-to-udibo -- --remote-password=Username-Password-Authentication auth0-users.ndjson udibo-import.ndjsonThe flag's value is the name of the Auth0 database connection your users sign in to, matched exactly; it is also the realm you give Udibo. Each database user of that connection gets:
| Import record | From Auth0 |
|---|---|
remotePassword.subject | user_id |
remotePassword.login | email, or username for a user with no email |
The command reports how many records it marked. It leaves a user unmarked, to sign in the step 3 way, when they are a social user or belong to another connection, when Auth0 has them blocked, or when their record cannot name the account safely. The repository's README lists every case under Mark the password users.
Then, in order:
Create the dedicated Auth0 application that Auth0 setup describes.
Register the source in your Udibo dashboard, under Sign-in → Migration, as set up the source describes.
Import one test user, and sign in as them, before the rest. A wrong
subjectorlogincannot be corrected after the import and looks like a wrong password every time. When someone can't sign in reads the refusal for you.Import the full file, the same way as at step 3.
Finish the migration after your end date, then delete the dedicated Auth0 application.
Leave users whom Auth0 asks for a second factor without remotePassword; the
password migration guide's Auth0 setup says why. The export does not say who
they are, so work from your own list.
Turn Auth0 off
Auth0 can go once all of these hold:
Every client has moved and the tokens Auth0 issued to it have expired.
The users are imported and the counts are reconciled.
If you took step 4, its end date has passed and you have told the people who never signed in that their first sign-in will be by email.
Keep the Auth0 configuration for your agreed rollback period, as cut over with a rollback plan describes: an account created only in Udibo does not exist in Auth0, and a password changed after the move does not work there.
How the example stays tested
The repository’s workflows run the install, test, export and conversion
commands below. The behaviour tests call the --remote-password command-line
handler directly:
On every pull request and every push to
main, on Node.js 22 and 24, with no tenant: the install,npm test,npm run test:behaviorandnpm run test:e2ethrough the local identity provider.Every Monday and on demand, the browser tests against an Auth0 tenant and a Udibo tenant. On other days the same job tests a newer
@udibo/oauth2release the first day npm lists one.By hand only, the export and the conversion against the Auth0 tenant, printing field names and counts and no value.
The README's Tested with table records the package version and the last run for each step.
Next: prepare the import file, compare Udibo and Auth0, and review production readiness.
Last verified 2026-11-29.

