Overview
In this guide, we’ll help you plan your migration from Auth0 to Rownd so that you can think through the process and avoid any pitfalls. We’ll also provide some code snippets to help you get started. Here’s what you’ll work through as part of this migration:- Creating a Rownd account and setting up your test and production apps.
- Updating your code to leverage Rownd instead of Auth0.
- Migrating your existing users to Rownd.
We’ve prepared a sample repository that demonstrates the migration process from a code perspective.
Set up Rownd
- Sign into the Rownd Platform. If this is your first visit, an account and app will be created for you automatically.
- Create a new Rownd app for your product. You'll probably want to create a separate app for your test and production environments.
- Enable the sign-in methods that you want to support. If you already have Google or Apple sign-in enabled, you can use the same credentials in Rownd.
- Customize the sign-in experience to match your brand with logos and colors.
- Create an Auth0 integration and attach it to your app. This will allow Rownd to migrate your existing users automatically.
Update back-end code
You’ll need to update your backend APIs to accept Rownd-signed JWTs instead of Auth0 JWTs. Use the Rownd SDK corresponding to the framework or language of your backend API server. Check out a full list of our backend SDKs. Our SDKs provide functions to validate Rownd tokens, fetch user data, and in some cases middleware that you can plug directly into your request handlers to authenticate usurs automatically. Here’s an example of using the Node.js SDK’s Express middleware:authenticate
middleware function from rownd.express
which validates a JWT in the Authorization
header and fetches profile data from Rownd, making it available on the request object for other request handlers. You can also build a middlware yourself or use one-off instances of rownd.validateToken(token);
and rownd.fetchUserInfo(token);
.
Update front-end code
Next, you’ll need to replace Auth0 with Rownd in your frontend. The exact steps will vary depending on the frontend framework you’re using and the authentication features of Auth0 that you are utilizing. We’ll use React as an example to demonstrate the steps below.- Install the
@rownd/react
dependency with your preferred package manager - Add the
RowndProvider
context provider.
RowndProvider
context provider. You should already have an Auth0Provider
somewhere in your app, which can help you find where you need to add this.
To keep existing users signed in during the migration, leave the existing
Auth0Provider
in place for now. Find out more about keeping users signed in during the migration.- Replace Auth0 hook with Rownd
useAuth0()
that you’ll need to replace with Rownd. Rownd exposes similar properties and functions through the useRownd()
hook. It should be pretty straightforward to swap out the Auth0 hook to use Rownd’s, and to adapt your code to use the Rownd properties.
withAuthenticationRequired
component, you’ll need to add the some equivalent Rownd code to enforce authentication. Use the useRownd()
hook to enforce authentication upon rendering of certain components
Keep existing users signed-in
Migrating your authentication to Rownd will help convert more users as they move through your funnel; however, what about the users you already have? They’ll quickly become frustrated if they get signed out as a result of the migration. To keep existing users signed in, you can pass their old Auth0 access token to Rownd for validation. Rownd will then issue a new token to the user so they’ll be able to continue using your product without interruption. Once the new token is issued, the auth0 token can be permanently discarded. Here’s a full example using the Rownd React SDK. We’ll break down the details below:- In your front-end code, at the top-level component, check if the user is already signed in to Rownd. If they are, you’re done!
Check if authenticated with Rownd
Check if authenticated with Rownd
- If they aren’t, check if they’re currently authenticated via Auth0. If they are, retrieve their ID token.
Get Auth0 access token
Get Auth0 access token
- Pass the token to Rownd for validation. If the token is valid, Rownd will issue a new token to the user.
Exchange for Rownd access token
Exchange for Rownd access token
is_authenticated
should now betrue
and the user can continue using your product normally.
Sync user profiles (optional)
Rownd supports multiple ways to sync your user data from Auth0. If you created and attached the Auth0 integration to your app, Rownd will begin migrating users “just in time,” meaning that as users sign in, their data will automatically be imported into Rownd (matched on email address, phone number, etc). However, pre-loading user data into Rownd will speed up the initial authentication handshake. You can use the Auth0 connector’s “sync” option to do a bulk import of all users from your Auth0 app to Rownd. Any users that sign-in after the sync begins will be auto-migrated using the “just in time” method.Test the migration
Once everything is set up, it's time to test various aspects of the migration. Here are some things to consider:-
Make sure new users can sign in successfully. If you use an email provider that supports sub-addressing, you can make up "new" users like
juliet+test1@gmail.com
and the messages will be delivered tojuliet@gmail.com
. - Verify existing users can sign in successfully and that they receive the same user ID that they had prior to the migration.
- If you chose to keep existing users signed in, test the migration flow to ensure that you remain signed in throughout the process. This usually means loading or installing the previous version of your product, signing in with your old provider, then loading the Rownd-enabled version of the app.