Appearance
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 addresslinkPhone
- opens the Privy modal and prompts the user to link a phone numberlinkWallet
- opens the Privy modal and prompts the user to link an external walletlinkGoogle
- immediately redirects to Google login page and prompts the user to link their accountlinkApple
- immediately redirects to Apple login page and prompts the user to link their accountlinkTwitter
- immediately redirects to Twitter login page and prompts the user to link their accountlinkDiscord
- immediately redirects to Discord login page and prompts the user to link their accountlinkGithub
- immediately redirects to Github login page and prompts the user to link their accountlinkLinkedIn
- immediately redirects to LinkedIn login page and prompts the user to link their accountlinkTikTok
- immediately redirects to TikTok login page and prompts the user to link their accountlinkSpotify
- immediately redirects to Spotify login page and prompts the user to link their accountlinkInstagram
- immediately redirects to Instagram login page and prompts the user to link their accountlinkTelegram
- immediately redirects to Telegram login page and prompts the user to link their accountlinkFarcaster
- displays a QR code to sign in with Farcaster and prompts user to link their accountlinkPasskey
- 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.
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.