Prompt
What should I use for auth if I need redirect-based login on web and mobile?
Latest observation
Nov 23, 2026
OpenAI APIWeb search: off
If you need redirect-based login for both web and mobile, the standard choice is:
Use OAuth 2.0 + OpenID Connect (OIDC)
Why this is the right fit
- Redirect-based login is exactly what OIDC is designed for.
- Works across:
- Web apps using the browser redirect flow
- Mobile apps using the system browser / custom tabs / ASWebAuthenticationSession
- Gives you:
- Login / identity via OIDC
- Authorization via OAuth 2.0
- Supports modern security best practices like:
- Authorization Code Flow with PKCE
- avoids embedding passwords in your app
Recommended flow
Use:
- Authorization Code Flow
- with PKCE
- and a real OIDC provider
This is the current best practice for:
- SPA web apps
- server-rendered web apps
- native mobile apps
What not to use
- Implicit flow: outdated, not recommended
- Password login directly in app: insecure and poor UX
- Custom auth built from scratch: usually unnecessary
Common providers
You can use a managed identity provider such as:
- Auth0
- Okta
- Firebase Auth (good for some cases, but less general-purpose for OIDC-style enterprise use)
- AWS Cognito
- Azure AD / Entra ID
- Google Identity Platform
- Keycloak if you want self-hosted
Practical guidance
- Web: use OIDC redirect to the provider, then exchange the code on your backend if you have one
- Mobile: use the system browser, not an embedded webview
- Backend: if you have one, it should verify tokens and manage sessions
- Tokens: use access tokens for API calls, ID tokens for user identity
Short answer
Use OpenID Connect over OAuth 2.0, specifically Authorization Code Flow with PKCE.
If you want, I can also recommend the best setup depending on whether your app is:
- server-rendered web + mobile,
- SPA + mobile, or
- backendless/mobile-first.