Migrating from AWS Cognito
Overview
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 Cognito for authentication.
- Migrating your existing users to Rownd.
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.
Update back-end code
You’ll need to update your backend APIs to accept Rownd-signed JWTs instead of AWS Cognito JWTs.
- Install the Rownd SDK for your back-end language or framework.
- Locate code that uses the AWS Cognito to manage users, validate tokens, and so on. Remove this code.
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 users automatically.
Here’s an example using Express middleware in Node.js:
Notice the use of the 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 middleware yourself or use one-off instances of rownd.validateToken(token)
and rownd.fetchUserInfo(token)
.
Update front-end code
- Install the
@rownd/react
dependency with your preferred package manager
- Add the
<RowndProvider>
to the app’s main entry.
- Replace all sign up and sign in buttons to trigger the
requestSignIn
flow for new or existing users.
- Replace ConfirmSignUp with is_authenticated API request
- Replace InitiateAuth with getAccessToken API request
- Replace sign out buttons to send a signOut API request
Sync user profiles (optional)
Export user data, then import it
-
To do a bulk import of all users from your Cognito to Rownd see our GitHub repo to export user data and transform your user data to the correct schema
-
Then use the following script to import your users into Rownd.