Prompt
I'm building one identity layer across web, mobile, and APIs; what should I use?
Latest observation
Oct 28, 2026
OpenAI APIWeb search: off
If you want one identity layer across web, mobile, and APIs, the usual answer is:
Use OIDC/OAuth 2.1 with a centralized Identity Provider (IdP)
That gives you:
- Web login with OpenID Connect
- Mobile app login with the same OIDC flow
- API access with OAuth 2.1 access tokens
- Single source of truth for users, sessions, MFA, account recovery, etc.
Recommended architecture
1) Identity Provider
Pick a mature IdP such as:
- Auth0
- Okta
- Azure AD / Entra ID
- AWS Cognito
- Keycloak if you want self-hosted
2) Protocols
- OpenID Connect (OIDC) for authentication
- OAuth 2.1 for authorization
- Use JWT access tokens or opaque tokens depending on your API strategy
3) App patterns
- Web: Authorization Code Flow + PKCE
- Mobile: Authorization Code Flow + PKCE in system browser
- APIs: Validate bearer tokens at the gateway or service layer
Best practice
- Use one central IdP
- Keep app logic out of authentication
- Use short-lived access tokens
- Use refresh tokens carefully, with rotation
- Prefer hosted login pages or browser-based login for web/mobile
- Use scopes/claims/roles to control access
If you mean “identity layer” more broadly
You may also want:
- SSO across products
- User provisioning via SCIM
- MFA / passwordless
- RBAC/ABAC
- B2B identity federation with SAML/OIDC
- API authorization with fine-grained policies
Quick recommendation by scenario
- Startup / fastest to ship: Auth0 or Clerk
- Enterprise / Microsoft-heavy: Entra ID
- Cloud-native / AWS-centric: Cognito
- Self-hosted / control: Keycloak
My short answer
If you’re designing this from scratch, use:
OIDC + OAuth 2.1 + PKCE + a centralized IdP
If you want, I can also give you:
- a reference architecture,
- a vendor comparison, or
- the exact flows for web vs mobile vs API.