For new React apps, we recommend the JavaScript SDK with React Hooks (@dynamic-labs-sdk/react-hooks) instead of the legacy React SDK documented here. The JS SDK comes with many benefits such as a much smaller bundle size and other optimizations. Use the React quickstart (JavaScript SDK) to get started.
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.
SocialOAuthErrorCode = "account_already_linked" | // trying to link an account for a provider that already has an account linked "account_already_linked_to_different_profile" | //trying to link an account that is already linked to a different user "invalid_provider" | // the provider is not a valid social provider "no_account_linked" | // trying to unlink the account for a provider that has no linked accounts "no_auth_code" | // oauth provider did not return a valid authorization code "no_oauth_url" | // could not find the oauth url to initiate linking flow "no_provider" | // a hook menthod was called without passing a provider when required "oauth_error" | // user denied access to account "oauth_window_timeout" | // user closed oauth window or left if open for too long without finishing auth flow "provider_not_enabled" | // the provider has not been enabled in the dashboard for the social account linking feature "session_timeout" | // user tried to authorize oauth after the timeout period "signin_error" | // could not sign-in with social account "social_linking_not_enabled" | // the social account linking feature has not been enabled in the dashboard so it cannot be used "unlink_error" | // could not unlink social account "verification_error" | // could not validate authorization code "general_error";