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:- 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.
- The user proves the new login, such as entering the code sent to the new email. Removing a login skips this step.
Requirements
- Create
ParaMobilewithsupportsAuthV2: 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 asopenAuthSessionAsyncfromexpo-web-browserorInAppBrowser.openAuthfromreact-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 (myappormyapp://).
Add a Login
{ 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.- Add the new email with
addAuthFactor. - Sign the user out with
para.logout(). - Sign the user in with the new email.
- Call
getAuthFactors(), find the old email’s login, and pass itsidtounlinkAuthFactor.
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, andunlinkAuthFactorwithRemoving the login was cancelled. IfonLinkUrldoesn’t return the browser’s promise, the SDK can’t tell the browser closed, and the call rejects only after 5 minutes withAccount link timed out(add) orRemoving 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
supportedAccountLinkssetting can narrow the list.