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

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

Param {PrivyErrorCode} - the corresponding error code

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 - opens the Privy modal and prompts the user to link their Google account

linkApple - opens the Privy modal and prompts the user to link their Apple account

linkTwitter - opens the Privy modal and prompts the user to link their Twitter account

linkDiscord - opens the Privy modal and prompts the user to link their Discord account

linkGithub - opens the Privy modal and prompts the user to link their Github account

linkLinkedIn - opens the Privy modal and prompts the user to link their LinkedIn account

linkTikTok - opens the Privy modal and prompts the user to link their TikTok account

linkSpotify - opens the Privy modal and prompts the user to link their Spotify account

linkFarcaster - opens the Privy modal and prompts the user to link their Farcaster 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

linkLinkedIn

linkLinkedIn: () => void

Returns

void

linkPhone

linkPhone: () => void

Returns

void

linkSpotify

linkSpotify: () => void

Returns

void

linkTiktok

linkTiktok: () => void

Returns

void

linkTwitter

linkTwitter: () => void

Returns

void

linkWallet

linkWallet: () => void

Returns

void