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 to link an email
  • linkPhone to link a phone number
  • linkWallet to link a wallet
  • linkGoogle to link a Google account
  • linkApple to link an Apple account
  • linkTwitter to link a Twitter account
  • linkDiscord to link a Discord account
  • linkGithub to link a Github account
  • linkTiktok to link a TikTok account
  • linkLinkedin to link a LinkedIn account
  • linkFarcaster to link a Farcaster account
  • linkSpotify to link a Spotify account
  • linkPasskey to link a passkey account

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.

Invoking these methods will open the Privy modal and guide the user through linking the desired account.

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>
  );
}

INFO

Due to issues with Twitter's mobile in-app browser, mobile users are currently unable to authenticate with their Twitter accounts on third-party sites. In kind, we strongly recommend that you do not call linkTwitter for users accessing your site from a mobile device, as they will likely encounter an authentication error.


We are following this issue. Please see this post on Twitter's Developer Forum for more information.