Skip to content

Linking additional accounts ​

Developers can use Privy to prompt users to link additional accounts (such as a wallet or Discord profile) at any point in their user journey, not just during login.

This is key to Privy's progressive onboarding: improving conversion and UX by requiring users to complete onboarding steps (e.g. connecting an account) only when necessary.

To prompt a user to link an account, use the respective method from the usePrivy hook:

  • linkEmail - opens the Privy modal and prompts the user to link an email address
  • linkPhone - opens the Privy modal and prompts the user to link a phone number
  • linkWallet - opens the Privy modal and prompts the user to link an external wallet
  • linkGoogle - immediately redirects to Google login page and prompts the user to link their account
  • linkApple - immediately redirects to Apple login page and prompts the user to link their account
  • linkTwitter - immediately redirects to Twitter login page and prompts the user to link their account
  • linkDiscord - immediately redirects to Discord login page and prompts the user to link their account
  • linkGithub - immediately redirects to Github login page and prompts the user to link their account
  • linkLinkedIn - immediately redirects to LinkedIn login page and prompts the user to link their account
  • linkTikTok - immediately redirects to TikTok login page and prompts the user to link their account
  • linkSpotify - immediately redirects to Spotify login page and prompts the user to link their account
  • linkInstagram - immediately redirects to Instagram login page and prompts the user to link their account
  • linkTelegram - immediately redirects to Telegram login page and prompts the user to link their account
  • linkFarcaster - displays a QR code to sign in with Farcaster and prompts user to link their account
  • linkPasskey - opens the Privy modal and prompts the user to link a passkey

INFO

Users are only permitted to link a single account for a given account type, except for wallets and passkeys. Concretely, a user may link at most one email address, but can link as many wallets and passkeys as they'd like.

Sample prompt to link an email
Sample prompt to link a user's email after they have logged in.

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 {ready, authenticated, user, linkEmail} = usePrivy();
  // You may replace this hook with any of the other `link-` hooks to
  // link a different account type.
  return (
    <button onClick={linkEmail} disabled={!ready || !authenticated || !!user.email}>
      Link your email
    </button>
  );
}

TIP

You can easily attach callbacks with linkAccount using the useLinkAccount interface! Read more here.