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.

The React SDK supports linking all supported account types via our modal-guided link methods. To prompt a user to link an account, use the respective method from the useLinkAccount hook:

MethodDescriptionUser Experience
linkEmailLinks email addressOpens modal
linkPhoneLinks phone numberOpens modal
linkWalletLinks external walletOpens modal
linkGoogleLinks Google accountDirect redirect
linkAppleLinks Apple accountDirect redirect
linkTwitterLinks Twitter accountDirect redirect
linkDiscordLinks Discord accountDirect redirect
linkGithubLinks Github accountDirect redirect
linkLinkedInLinks LinkedIn accountDirect redirect
linkTikTokLinks TikTok accountDirect redirect
linkSpotifyLinks Spotify accountDirect redirect
linkInstagramLinks Instagram accountDirect redirect
linkTelegramLinks Telegram accountDirect redirect
linkFarcasterLinks Farcaster accountDisplays QR code
linkPasskeyLinks passkeyOpens modal

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 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:

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

function LinkOptions() {
    const {linkEmail, linkGoogle, linkWallet} = useLinkAccount();

    return (
        <div className="link-options">
            <button onClick={linkEmail}>Link Email to user</button>
            <button onClick={linkGoogle}>Link Google account to user</button>
            <button onClick={linkWallet}>Link Wallet to user</button>
        </div>
    );
}

Callbacks

You can optionally register an onSuccess or onError callback on the useLinkAccount hook.

const {linkGoogle} = useLinkAccount({
    onSuccess: ({user, linkMethod, linkedAccount}) => {
        console.log('Linked account to user ', linkedAccount);
    },
    onError: (error) => {
        console.error('Failed to link account with error ', error)
    }
})
onSuccess
({user: User, linkMethod: string, linkedAccount: linkedAccount}) => void

Optional callback to run after a user successfully links an account.

onError
(error: string) => void

Optional callback to run after there is an error during account linkage.

Looking for whitelabel link methods? Our useLoginWith<AccountType> hooks allow will link an account to a user, provided that the user is already logged in whenever the authentication flow is completed.