Skip to main content

Overview

A signed-in user can add another login to their Para account (an email, a phone number, a social login, or an external wallet) or remove one. Each change runs on a Para-hosted page that your app opens in an in-app browser:
  1. The user confirms it’s them by re-proving the login they’re signed in with, such as a code to their email or phone, a social sign-in, or a wallet signature.
  2. The user proves the new login, such as entering the code sent to the new email. Removing a login skips this step.
The user id and wallets never change. See Account Linking for how linking works across Para.

Requirements

  • Create ParaMobile with supportsAuthV2: true: new ParaMobile(env, apiKey, undefined, { supportsAuthV2: true }). See Email & Phone Login. Without it, every linking method throws <method> needs auth v2 on React Native: create ParaMobile with supportsAuthV2: true to link logins.
  • Register a URL scheme for your app, as in Social Login. The Para-hosted page returns to your app on it.
  • Pass these options to every linking method:
    • onLinkUrl: opens the Para-hosted page in an auth session, such as openAuthSessionAsync from expo-web-browser or InAppBrowser.openAuth from react-native-inappbrowser-reborn. Don’t use a WebView. Return the browser’s promise so the call ends when the user closes the browser.
    • appScheme: your app’s URL scheme (myapp or myapp://).

Add a Login

The call resolves with { status: 'linked', factor } once the login is on the account. Use the method that matches the login:

List and Remove Logins

getAuthFactors() lists the account’s logins. Each has an id, a type, and an identifier (the email, phone number, wallet address, or social account). isUnlinkable is false for logins the user can’t remove, so you can hide or disable the control.
unlinkAuthFactor resolves with the updated list of logins.

Change a User’s Email

The account keeps its user id and wallets throughout.
  1. Add the new email with addAuthFactor.
  2. Sign the user out with para.logout().
  3. Sign the user in with the new email.
  4. Call getAuthFactors(), find the old email’s login, and pass its id to unlinkAuthFactor.
The user signs back in with the new email first because a session can’t remove the login it signed in with.

Errors and Limits

The linking methods reject, and the account doesn’t change, when:
  • The user closes the browser before the change finishes: the add methods reject with Account link cancelled, and unlinkAuthFactor with Removing the login was cancelled. If onLinkUrl doesn’t return the browser’s promise, the SDK can’t tell the browser closed, and the call rejects only after 5 minutes with Account link timed out (add) or Removing the login timed out (remove).
  • The login belongs to another Para account (FACTOR_CONFLICT).
  • The login is the one the current session signed in with (FACTOR_IN_USE).
  • The login is the account’s last usable login (FACTOR_LAST_REMAINING).
  • Your project doesn’t allow linking that login type. By default every type is allowed; the project’s supportedAccountLinks setting can narrow the list.

Next Steps