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
The hook can receive an optionalsessionTimeout
param that is used to cancel sign-in/linking due to inactivity. Itβs value should be a number (time in milliseconds) and defaults to 10s (10000 ms).
Note: This is mainly used for X/Twitter oauth, since we cannot detect when the oauth window is closed for this provider.
Example setting timeout to 20s:
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 |