> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getpara.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Account Linking

> Let users add or remove logins on their Para account from a React Native or Expo app.

## 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](https://docs.getpara.com/v3/general/account-linking.md) for how linking works across Para.

## Requirements

* Create `ParaMobile` with `supportsAuthV2: true`: `new ParaMobile(env, apiKey, undefined, { supportsAuthV2: true })`. See [Email & Phone Login](https://docs.getpara.com/v3/react-native/guides/add-email-phone.md). 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](https://docs.getpara.com/v3/react-native/guides/add-social-login.md). 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

```typescript theme={null}
import { para } from "../your-para-client";
import { openAuthSessionAsync } from "expo-web-browser";

const APP_SCHEME = "your-app-scheme";

const linkOptions = {
  appScheme: APP_SCHEME,
  // Return the promise so closing the browser ends the call
  onLinkUrl: (url: string) => openAuthSessionAsync(url, APP_SCHEME),
};

async function addEmail(email: string) {
  try {
    const { factor } = await para.addAuthFactor({ method: "EMAIL", email, ...linkOptions });
    console.log("Linked:", factor);
  } catch (error) {
    console.error("Linking failed:", error);
  }
}
```

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

| Login | Method |
| - | - |
| Email | `para.addAuthFactor({ method: "EMAIL", email, ...linkOptions })` |
| Phone | `para.addAuthFactor({ method: "PHONE", phone, countryCode, ...linkOptions })` |
| Social login | `para.addOAuthFactor({ provider, ...linkOptions })`. Pass `providerConfigHandle` for a named custom connection. |
| External wallet | `para.addExternalWalletFactor({ address, chainType, uri, ...linkOptions })`. `uri` is your app's https origin, shown in the message the wallet signs, and is required. |

## 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.

```typescript theme={null}
async function removeLogin(factorId: string) {
  const factors = await para.unlinkAuthFactor({ factorId, ...linkOptions });
  console.log("Remaining logins:", factors);
}
```

`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

* [Account Linking](https://docs.getpara.com/v3/general/account-linking.md)
* [Email & Phone Login](https://docs.getpara.com/v3/react-native/guides/add-email-phone.md)
* [React Native API Reference](https://docs.getpara.com/v3/react-native/api/sdk.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.