useSSOCallback
TheuseSSOCallback hook handles OAuth and SSO callbacks from external identity providers like Google, GitHub, and enterprise SAML providers.
Return Value
Whether the callback is being processed
Any error that occurred during processing
The session after successful sign-in
The URI to redirect to after processing
Whether the callback has been processed
The current sign-in attempt state
Behavior
The hook:- Automatically reads OAuth parameters from the URL (
code,state,error) - Validates the OAuth state parameter
- Determines the callback type (sign-in or social connect)
- Calls the appropriate backend endpoint
- Handles errors appropriately
Error Handling
If the callback includes an error parameter, it will be available in theerror return value.
OAuth State
The state parameter encodes:- sign_in - Standard sign-in flow
- connect_social - Connecting a social account
Examples
SSO Callback Page
With Error Display
URL Parameters
The hook reads these parameters from the URL:OAuth authorization code
Base64-encoded OAuth state with action and signature
OAuth error code
OAuth error description
Related
- SSOCallback - SSO callback component
- useSignIn - Sign-in with SSO support
