Skip to content

Documentation / react-auth / useLinkAccount

Function: useLinkAccount()

useLinkAccount(callbacks?): Object

Use this hook to link a new account to an authenticated user, and to attach callbacks for success and errors.

Parameters

callbacks?: Object

callbacks.onError?: (error, details) => void

Callback that will execute in the case of a non-successful account linking.

Param {PrivyErrorCode} - the corresponding error code

Param {LoginMethod} - the type of (attempted) linked account

callbacks.onSuccess?: (user, linkMethod, linkedAccount) => void

Callback that will execute once on a successful linking of a new account/login method. This will run when any of the 'link' methods are called manually.

ParamUser- the user the account was linked to

Param [LoginMethod]([object Object])- the type of linked account

Param the newly linked account

Returns

Object

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

linkApple

linkApple: () => void

Returns

void

linkDiscord

linkDiscord: () => void

Returns

void

linkEmail

linkEmail: () => void

Returns

void

linkFarcaster

linkFarcaster: () => void

Returns

void

linkGithub

linkGithub: () => void

Returns

void

linkGoogle

linkGoogle: () => void

Returns

void

linkInstagram

linkInstagram: () => void

Returns

void

linkLinkedIn

linkLinkedIn: () => void

Returns

void

linkPhone

linkPhone: () => void

Returns

void

linkSpotify

linkSpotify: () => void

Returns

void

linkTelegram

linkTelegram: () => void

Returns

void

linkTiktok

linkTiktok: () => void

Returns

void

linkTwitter

linkTwitter: () => void

Returns

void

linkWallet

linkWallet: () => void

Returns

void