Skip to content

Unlinking accounts

Once a user has linked additional accounts to their profile, you may also want to give them the option to unlink those accounts.

Use the following methods from the usePrivy hook to unlink a given account from a user:

  • unlinkApple to unlink an Apple account
  • unlinkDiscord to unlink a Discord account
  • unlinkEmail to unlink an email
  • unlinkFarcaster to unlink a Farcaster account
  • unlinkGithub to unlink a Github account
  • unlinkGoogle to unlink a Google account
  • unlinkInstagram to unlink a Instagram account
  • unlinkLinkedin to unlink a LinkedIn account
  • unlinkPasskey to unlink a passkey account
  • unlinkPhone to unlink a phone number
  • unlinkSpotify to unlink a Spotify account
  • unlinkTiktok to unlink a TikTok account
  • unlinkTwitter to unlink a Twitter account
  • unlinkWallet to unlink an external wallet

Unlinking deletes the account from the underlying user object, meaning the user can no longer sign-in to your app with that account. Note that embedded wallets cannot be unlinked from a user's account.

INFO

Each unlink- method accepts a string to determine which account to unlink. For example, to unlink the email address '[email protected]' from a user, you might call unlinkEmail('[email protected]').

Below is an example button for prompting a user to link an email to their account:

tsx
import {usePrivy} from '@privy-io/react-auth';

function Page() {
  const {user, unlinkEmail} = usePrivy();
  return (
    <button
      disabled={!ready || !authenticated || !user.email}
      onClick={() => unlinkEmail(user.email.address)}
    >
      Unlink your email
    </button>
  );
}

TIP

Every user must have at least one account linked to their profile that is not an embedded wallet.


Accordingly, if a user has only one account linked that is not an embedded wallet, it cannot be unlinked from their profile unless they link a second account.