Migrate from Amazon Cognito
Move Amazon Cognito user pool profiles, groups and federated identities into Pontive with pontive migrate. Cognito exports no password hashes, so password users set a new one at their first sign-in. Then replace Amplify with pontkit.
The steps below use the pontive migrate CLI. Read Migrate to Pontive first
for how runs, dry runs and matching work.
1. What moves and what does not
| Moves | Does not move |
|---|---|
Users from ListUsers: email and email_verified, phone_number and its verified flag, preferred_username, name, given_name, family_name, picture, locale, the creation date; disabled users as deactivated | Password hashes. No Cognito API returns them, so every password user uses Forgot password at their first Pontive sign-in |
Custom attributes (custom:…, without the prefix) as private_metadata | TOTP and SMS factors: no secrets are exportable, so those users enroll again |
Groups, as metadata.cognito_groups on each user | Groups as roles or organizations: map them yourself (step 4) |
Google, Sign in with Apple and OIDC identities whose userId is the provider's subject | SAML, Facebook and Login with Amazon identities, and identities linked on another attribute: those users link by verified email |
The user's sub, as legacy subject and external_id | Users without an email |
Since every password user resets, tell them before the cutover, from your own system: Pontive sends nothing to imported users.
2. Create the migration source
export PONTIVE_SECRET_KEY=pontive_sk_test_us_... # an admin key of your development instance
npx pontive@latest migrate source create --name "Cognito" --type cognito # prints msrc_...3. Export, then dry run
The exporter uses the AWS SDK's default credentials (environment, profile or SSO) and needs
cognito-idp:ListUsers, ListGroups and ListUsersInGroup on the pool. The region is
AWS_REGION, else the pool id's prefix.
export AWS_PROFILE=prod
npx -p pontive@latest -p @aws-sdk/client-cognito-identity-provider \
pontive migrate export cognito --user-pool-id us-east-1_AbC123 # writes pontive-users.ndjson
npx pontive@latest migrate import pontive-users.ndjson --source msrc_...The AWS SDK is not installed with pontive, hence -p. The report's password users without a
hash is every user who is not federated-only.
4. Map roles and connections
Identities. Map them to the Pontive app's auth connections. Import Apple identities only when
your Pontive Apple connection uses the same Apple developer team, and oidc ones only for the same
issuer:
npx pontive@latest migrate import pontive-users.ndjson --source msrc_... \
--identity-connection google=app_...:googleGroups. They arrive as metadata.cognito_groups. What they become depends on what they meant:
- Permission groups (
editors,admins) become roles on the instance. Create each role on theroottype (POST /v1/authz/resource-types/root/roles), then, once the users are imported, add each group's users withPOST /v1/root/members, withuser_idandroles.GET /v1/users?migration_source_id=msrc_...lists the imported users with their metadata. A token with no organization then carries those roles inroles, where Cognito's carriedcognito:groups. - Customer groups in a
b2bproject become organizations. Append anorganizationline per group to the file before importing, members named by the Cognitosub, at least one of themowner:
{"kind":"organization","external_id":"acme","name":"Acme Corp","members":[{"legacy_subject":"6f1c…","roles":["owner"]},{"legacy_subject":"92ab…","roles":["admin"]}]}5. Apply
npx pontive@latest migrate import pontive-users.ndjson --source msrc_... \
--identity-connection google=app_...:google \
--apply --delete-afterFailed rows: npx pontive@latest migrate records uimp_... --outcome failed.
6. Swap the SDK
Follow the React quickstart or the Next.js quickstart, then replace Amplify:
npm uninstall aws-amplify @aws-amplify/ui-react
npm install @pontive/pontkit-react| Amplify and Cognito | pontkit |
|---|---|
Amplify.configure(…) and <Authenticator> | <Provider domain appId signinUrl signupUrl> with <Signin /> and <Signup /> pages |
signIn, signUp, confirmSignUp, resetPassword | the flows inside <Signin /> and <Signup />, including forgot password |
getCurrentUser() | Auth.getAuthenticatedUser(), Auth from @pontive/oidc-client |
fetchAuthSession(), tokens.accessToken | Auth.getCurrentSession()?.access_token |
signOut() | Auth.signOut() |
aws-jwt-verify's CognitoJwtVerifier | rs.requireBearer() from @pontive/pontkit-server/resource-server (Protect an API) |
The cognito:groups claim | the roles and permissions claims |
The Hosted UI on *.amazoncognito.com | your instance's auth domain: register the app's redirect URIs and allowed origins there |
7. Cut over
Follow the cutover checklist. For Cognito in particular:
- Export again just before switching and import into the same run with
--run uimp_.... - If your data keys users by Cognito
sub, set the app's claims template to{ "legacy_user_id": "{{ user.external_id }}" }. - Turn off the user pool's sign-ups and messages once the app is on Pontive.
8. Revert
npx pontive@latest migrate revert uimp_... # dry run
npx pontive@latest migrate revert uimp_... --applyUsers who have signed in to Pontive since are kept and listed. See Revert.
Migrate from Supabase Auth
Move Supabase Auth users, bcrypt password hashes, TOTP factors and social identities into Pontive with pontive migrate, keep your data in Supabase, and keep Row Level Security policies working through the cutover.
Migrate from NextAuth.js (Auth.js)
Move a NextAuth.js or Auth.js app's users, OAuth accounts and Credentials password hashes into Pontive by writing the pontive-users/v1 file from the adapter's tables, then replace NextAuth with pontkit.