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
to link an emaillinkPhone
to link a phone numberlinkWallet
to link a walletlinkGoogle
to link a Google accountlinkApple
to link an Apple accountlinkTwitter
to link a Twitter accountlinkDiscord
to link a Discord accountlinkGithub
to link a Github accountlinkTiktok
to link a TikTok accountlinkLinkedin
to link a LinkedIn accountlinkFarcaster
to link a Farcaster accountlinkSpotify
to link a Spotify accountlinkPasskey
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.
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.