OAuth login flow
The social login flow involves three steps:- Redirect — Your app redirects the user to the provider’s login page
- Callback — The provider redirects back to your app with a
challenge_token - Finalize — Your app sends the
challenge_tokento complete authentication
How is the OAuth flow secured?
How is the OAuth flow secured?
The entire flow is protected by PKCE (Proof Key for Code Exchange). The SDK generates a unique
code_verifier and code_challenge pair for each login attempt, and the challenge_token can only be finalized once. This protects against:- Authorization code interception — A stolen
challenge_tokenis useless without thecode_verifier, which never leaves the browser - Replay attacks — The
challenge_tokenis invalidated after a single use - Cross-site request forgery (CSRF) — The server validates that the finalize request matches the original authorization request
Redirect to the provider
UseloginWithOAuth to redirect the user to the provider’s authorization page:
redirectURI must match the redirect URI configured in your OAuth provider settings.
Handle the callback
When the provider redirects back to your app, extract thechallenge_token from the URL and finalize the login:
Try it
Try it
Replace
src/App.jsx with:src/App.jsx