This guide walks through adding OAuth to Stytch’s pre-built login UI. If you want a fully custom OAuth flow, see Adding OAuth to a custom auth flow.
Prerequisites
If you haven’t done so already:- Complete the steps in the OAuth provider setup guide.
- Enable the Frontend SDKs in your Stytch Dashboard and add your application’s domain to Authorized Domains.
- Configure your Redirect URLs.
Add OAuth providers to your UI config
To surface the OAuth providers you want to support in the UI, add them to theoauthOptions.providers array in your config.
You can add multiple OAuth providers by including additional provider objects in the
providers array. See the OAuth providers guide for provider-specific setup steps.Render the login UI
Render the Stytch Login UI on the Redirect URL(s) you configured in the Stytch Dashboard. When rendered, the UI component will automatically handle the OAuth redirect and complete the authentication flow.Test your integration
- Navigate to your login page.
- Click an OAuth provider button (e.g., “Continue with Google”).
- Complete the OAuth flow with the provider.
- Verify that you’re redirected back to your application and authenticated.
Next steps
Customize the UI
Learn how to customize the appearance and behavior of the pre-built login UI.
Add more providers
Configure additional OAuth providers like GitHub, Slack, or Apple.