Skip to content
Start with Identity
Fundamentals · Intermediate

OAuth vs OIDC: The Difference and How the OIDC Flow Works

By SWI Community Team · Updated 2026-11-05 · 9 min

OAuth 2.0 vs OIDC comes down to one question: access or identity. OAuth 2.0 is an authorization framework that gives an application delegated access to an API through access tokens. OpenID Connect (OIDC) is an identity layer on top of OAuth 2.0 that adds authentication through a signed ID token describing who the user is. Use OIDC to log a user in; use OAuth to let an app call an API.

Using the wrong one creates real security holes, which is why the distinction matters more than the acronyms. The same split runs through authentication vs authorization.

OAuth 2.0 vs OIDC side by side

OAuth 2.0 OpenID Connect
Answers What may this app do on the user's behalf? Who is the user, and when did they sign in?
Specification (November 2026) RFC 6749 (2012), hardened by RFC 9700 (January 2025); OAuth 2.1 at draft-17 OIDC Core 1.0 with errata set 2 (December 2023); ISO/IEC 26131:2024
Main token Access token, format not defined by RFC 6749 ID token, always a signed JWT
Token audience The resource server (API) The client application
Trigger Any scope, such as calendar.read The openid scope
Extra endpoints Authorization, token Adds userinfo, discovery (/.well-known/openid-configuration), JWKS
Typical use API access, integrations, AI agents calling tools Single sign-on, social login, customer sign-in

How the OIDC flow works

The authorization code flow with PKCE is the one to use, for every client type:

  1. Discovery. The client reads the provider's metadata from /.well-known/openid-configuration: endpoints, supported algorithms and the JWKS URI.
  2. Authorization request. The client redirects the browser to the authorization endpoint with response_type=code, scope=openid plus any other scopes, a state, a nonce and a PKCE code_challenge.
  3. Authentication. The provider signs the user in, applying its own MFA and policy, and redirects back with a one-time code.
  4. Token request. The client sends the code and the PKCE code_verifier to the token endpoint and receives an ID token, usually an access token, and optionally a refresh token.
  5. Validation. The client checks the ID token signature against the provider's published keys, that iss matches exactly, aud contains its client_id, exp is in the future and nonce matches.
  6. Session. The client creates its own session from the sub claim and sends only the access token to APIs.

Plain OAuth is the same dance without step 5's ID token: the client gets an access token and calls the API, and never learns who the user is in a standard way. See the authorization code flow entry and the OAuth 2.0 and OIDC implementation guide.

Why the confusion causes real bugs

Using an access token as proof of identity. An access token says a client was authorized for some scope. It does not say who the user is, and in many designs it is not audience-restricted to your application. Accepting one as a login credential lets a token minted for a different application authenticate against yours. Use the ID token for authentication and derive your own session from it.

Sending an ID token to an API. The mirror image, and just as common. ID tokens are for the client, validated once at sign-in. Resource servers should receive access tokens. An API that accepts ID tokens is validating the wrong audience, or not validating at all.

Skipping validation entirely. CVE-2026-48558 let attackers forge OIDC tokens against SimpleHelp servers that did not properly validate signatures, giving technician access without credentials or MFA, and it was exploited in 2026 (incident record). CVE-2025-9485 in a WordPress OAuth SSO plugin and CVE-2026-5430 in WSO2 API Manager are the same class: JWT checks that accepted what they should have rejected.

What attackers do with OAuth in practice

The OAuth incidents in SWI's breach database rarely break the protocol. They abuse grants that work as designed:

  • Consent phishing. UNC6040 phoned employees and talked them into authorizing a modified Salesforce Data Loader app (OAuth consent phishing). A password reset does not revoke a grant.
  • Stolen refresh tokens. In the Salesloft Drift campaign, third-party app tokens gave standing access to many Salesforce tenants until Salesloft and Salesforce revoked them (refresh token abuse).
  • Token replay. Bearer tokens work for whoever holds them. In 2026 stolen Microsoft 365 session tokens were replayed into 79 organizations, with device code phishing among the methods (token replay).
  • Forged signing keys. Storm-0558 forged tokens with a stolen Microsoft consumer key, and a validation flaw let them open enterprise mailboxes. Strict issuer and audience checks are the client-side defense.

The current best practice

OAuth 2.1 consolidates a decade of security guidance into defaults worth adopting even if you stay on 2.0:

  • Authorization code with PKCE for every client, confidential ones included.
  • No implicit flow. Returning tokens in the redirect puts them in URLs, browser history, and referrer headers.
  • No resource owner password grant. It requires the application to handle credentials, which is the thing OAuth exists to avoid.
  • Exact redirect URI matching, not prefix or wildcard.
  • No bearer tokens in query strings, and only the S256 PKCE method.
  • Rotate refresh tokens on use and detect reuse of a spent token, which is the signal that a copy is circulating.

Where OAuth and OIDC are heading in 2026

Bearer tokens are the last large replay hole, which is why sender-constraining is gaining ground: DPoP binds a token to a key the client proves possession of, and mTLS does the same where you control the transport. AI agents run on the same machinery: the MCP authorization revision of July 28, 2026 builds on the OAuth 2.1 draft and RFC 9728, token exchange narrows scope at each hop, and the ID-JAG draft (draft-06, October 31, 2026) lets an enterprise IdP broker one app's access to another. GNAP (RFC 9635) is the clean-slate IETF alternative, but new deployments still build on OAuth 2.1.

Choosing an OIDC provider

For customer web login, most teams buy an OpenID provider rather than run one. Free tiers checked on October 30, 2026 for the Identity Pricing Transparency Index include Microsoft Entra External ID at 50,000 MAU, Auth0 at 25,000 MAU and Amazon Cognito at 10,000 MAU. Self-hosted options include Keycloak and Zitadel. Compare them in the best CIAM platforms ranking, and read SAML vs OIDC if enterprise customers will federate in.

Frequently asked questions

What is the difference between OAuth and OIDC?
OAuth 2.0 is an authorization framework for granting an application limited access to an API through access tokens. OpenID Connect, or OIDC, is an identity layer built on top of OAuth that adds authentication: a signed ID token telling the application who the user is and when they signed in. Use OIDC to log users in and OAuth to call APIs.
How does OIDC work?
The application redirects the user to the OpenID provider with scope=openid and a PKCE challenge. The provider authenticates the user and redirects back with a one-time authorization code. The application exchanges the code at the token endpoint for an ID token (a signed JWT about the user) and usually an access token, validates the ID token's signature, issuer, audience, expiry and nonce, and starts its own session.
What is OAuth2?
OAuth 2.0 is the IETF authorization framework defined in RFC 6749 (October 2012). It lets a user grant an application scoped access to their resources at another service, such as a calendar, without sharing a password. RFC 9700, the OAuth 2.0 Security Best Current Practice published in January 2025, is the current guide to deploying it safely.
Can you use OAuth for login?
Not on its own. An OAuth access token says a client was authorized for some scope; it does not reliably say who the user is or that it was issued for your application. OIDC was created to handle login correctly on top of OAuth, with an ID token whose audience is your client.
What is an ID token?
An ID token is a signed JWT issued by an OpenID provider that conveys who the user is (the sub claim), who issued it, which client it is for, and when the user authenticated. It is meant for the client application, distinct from the OAuth access token used to call APIs.
Is OAuth 2.1 a standard yet?
Not yet. OAuth 2.1 is an IETF OAuth working group draft; draft-17 was published on October 31, 2026, with an IESG milestone of December 2026. It folds OAuth 2.0, PKCE and RFC 9700 into one document and removes the implicit and password grants. You can adopt its rules today on OAuth 2.0.
Is OpenID Connect an ISO standard?
Yes. OpenID Connect Core 1.0 incorporating errata set 2 was published as ISO/IEC 26131:2024 in October 2024 and approved by the ITU-T as Recommendation X.1285 on May 29, 2025. The OpenID Foundation text remains the reference implementers read.
Which OIDC flow should a new application use?
The authorization code flow with PKCE, for web, mobile and single-page apps alike. RFC 9700 says clients should not use response types that return access tokens in the authorization response, and OAuth 2.1 removes the implicit grant.
Last reviewed By SWI Community TeamSuggest a correctionHow we research