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

# Prompt users to auth new devices

> Prompt users to authenticate on new devices before accessing their embedded wallets

<View title="React" icon="react">
  The React SDK will automatically prompt users for their auth factor on new devices when they use
  their wallet. There is no additional logic your application must implement to handle this.
</View>

<View title="React Native" icon="react">
  When a user uses their embedded wallet on a new device for the first time, the wallet must first be recovered on that device

  By default, wallets created for your users will be [automatically provisioned](/wallets/overview) and should never need recovery. For these wallets, you can skip these steps and directly request a signature or transaction.

  <Info>
    For wallets where the `recovery_method` is `'privy'` the wallet will be automatically recovered
    and should never need recovery. For these wallets, you can skip these steps and directly request a
    signature or transaction.
  </Info>

  ### Setting up your recovery listener

  The wallet must be recovered before you can request signatures or transact with the embedded wallet.
  The React Native SDK will try to recover the user's wallet once you start interacting with it.
  We recommend that you set up a global listener on your application to handle manual recovery in a single place.

  To set up this configuration, use Privy's `useOnNeedsRecovery` hook.
  AS a parameter, you must pass in an object defining the the `onNeedsRecovery` callback.

  `onNeedsRecovery` will receive two parameters to drive what recovery looks like:

  | Parameter        | Type                                                                                    | Description                                                                                          |
  | ---------------- | --------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
  | `recoveryMethod` | `"privy" \| "user-passcode" \| "google-drive" \| "icloud" \| "recovery-encryption-key"` | An enum representing the recovery method used for this user.                                         |
  | `onRecovered`    | `() => void`                                                                            | This is a callback function you should call once recovery has been completed. It takes no arguments. |

  ```ts theme={"system"}
  import {useOnNeedsRecovery, useRecoverEmbeddedWallet} from '@privy-io/expo';

  // This could live in a different screen,
  // e.g. if you navigate to a recovery screen when the listener is triggered
  const {recover} = useRecoverEmbeddedWallet();

  useOnNeedsRecovery({
    onNeedsRecovery: async ({recoveryMethod, onRecovered}) => {
      if (recoveryMethod === 'user-passcode') {
        // Get the passcode from the user, e.g. by prompting some UI
        const password = 'user-provided-passcode';
        await recover({recoveryMethod, password});
        // Remember to call this after recovery has been completed.
        onRecovered();
      }
    }
  });
  ```

  ### Recovering the wallet

  **To recover an embedded wallet for your user, use the `recover` function returned by the Privy React Native SDK's `useRecoverEmbeddedWallet` hook.**

  You can determine the proper arguments for `recover` via the `account.recovery_method` property on the embedded wallet account:

  * `user-passcode`, call `recover` with `recoveryMethod: 'user-passcode'` and the user input `password`.
  * `google-drive`, call recover with `recoveryMethod: 'google-drive'`.
  * `icloud`, call recover with `recoveryMethod: 'icloud'`. *Note: this is only supported on iOS devices*.
</View>
