Hooks
useSocialAccounts
Summary
A hook which can be used to trigger sign-in with social or social account linking and unlinking for an authenticated user. The hook needs to be initialized within a child of DynamicContextProvider.
Usage
Available functions and states:
Method | Type | Description |
---|---|---|
error | SocialOAuthError | undefined | Contains the code and message in case of an error during the link or unlink process |
getLinkedAccountInformation | (provider: ProviderEnum) => SocialAccountInformation | Returns an object with the information about the linked account for the specified provider if there’s a linked account. If not, returns undefined. |
isLinked | (provider: ProviderEnum) => boolean | Returns true if user has an account linked for the specified provider. Otherwise returns false. |
isProcessing | boolean | Indicates whether a link or unlink request is in process |
linkSocialAccount | (provider: ProviderEnum) => Promise<void> | When called, will trigger the oauth linking for the specified provider |
signInWithSocialAccount | (provider: ProviderEnum) => Promise<void> | When called, will trigger the oauth sign-in for the specified provider |
unlinkSocialAccount | (provider: ProviderEnum) => Promise<void> | When called, it will unlink the user account for the specified provider |
Types
Linking/unlinking example
Sign-in example
Was this page helpful?