OAuth 2.0 lets an application request permission to access a resource; OpenID Connect (OIDC) adds a standardized way to sign a person in and establish their identity. They are complementary, not competing login systems. A typical “Sign in with Google” experience uses OIDC to authenticate the user and may also use OAuth 2.0 access tokens if the application needs permission to call an API. The crucial rule: an access token is not proof of who signed in.

OAuth vs OpenID Connect in one table
| Question | OAuth 2.0 | OpenID Connect |
|---|---|---|
| Main purpose | Delegated authorization to access a protected resource | Authentication of the end user, using OAuth 2.0 flows |
| Typical scenario | Let an app read a user’s calendar with permission | Let a user sign in to an app using an identity provider |
| Key artifact | Access token for a resource server | ID token for the client; access tokens may also be issued |
| Who consumes it? | API/resource server validates the access token | Client/relying party validates the ID token |
| Identity proof? | Not by itself | Yes, when the ID token is correctly validated |
| Standards | OAuth 2.0 authorization framework | OpenID Connect specifications built on OAuth 2.0 |
The OpenID Foundation describes OIDC as an identity layer built on OAuth 2.0. Microsoft’s authentication vs authorization guide makes the same practical distinction.
A real-world example: a calendar app
Imagine you build a study-planner app that wants to show the learner’s calendar events. There are two separate questions:
- Who is the learner? If the app supports sign-in through an identity provider, OIDC can provide an ID token that the app validates to establish the user’s identity.
- May the app read calendar events? OAuth 2.0 can let the learner authorize scoped API access. The calendar API checks the access token and the permissions granted.
Signing in does not automatically grant access to the calendar. Granting access to a calendar API does not, by itself, mean the app has safely authenticated the person. Keeping these questions separate avoids a common security mistake.
Original flow diagram: where each token belongs
| Step | Actor | What happens | Important check |
|---|---|---|---|
| 1 | Learner → study app | Clicks Sign in | App starts a supported OIDC flow |
| 2 | Study app → identity provider | Redirects the user to authenticate and consent where needed | State, nonce and PKCE are used as appropriate |
| 3 | Identity provider → app | App obtains tokens through the supported flow | Validate the ID token for sign-in |
| 4 | App → calendar API | App presents an access token to request events | API validates the access token, audience, scope and other claims |
| 5 | Calendar API → app | Returns only permitted data | Least privilege and privacy safeguards apply |
Important: This table is a simplified explanatory model. Actual authorization-code flows, token handling, browser sessions and identity-provider behavior vary. Never copy a flow diagram into production without following the provider’s current implementation documentation.
ID token vs access token vs refresh token
| Token | Purpose | Do not use it for |
|---|---|---|
| ID token | Tell the client about the authenticated end user | Calling a protected API merely because it contains identity claims |
| Access token | Authorize requests to the intended API/resource | Proving a user is logged in to your app |
| Refresh token | Obtain new tokens under provider policy | Public exposure or casual browser storage |
Tokens can be opaque or structured differently depending on the system. A JWT-shaped string is not automatically trustworthy. For ID tokens, validate issuer, audience, expiration, signature and any other claims required by the provider and flow. For access tokens, validation belongs to the intended resource server according to its contract.
How does “Sign in with Google” actually work?
A website that offers Google sign-in typically redirects the browser to Google’s identity service and uses a supported OIDC flow. The site receives a result it must validate before creating its own application session. If it also needs to call a Google API, it requests the necessary permissions and handles the access token separately. Google sign-in should not be implemented by taking an arbitrary API access token and treating it as a user identity.
Five common beginner mistakes
- Using OAuth alone as login proof: An API token intended for a resource is not necessarily an authentication assertion for the client.
- Confusing the token audience: A token for API A must not be accepted by API B or by a different client merely because it looks valid.
- Skipping token validation: Reading a JWT payload is not the same as verifying its signature, issuer, audience and expiry.
- Requesting excessive scopes: An app that only needs a calendar read operation should not request unrelated broad permissions.
- Writing a custom login flow from scratch: Use current provider SDKs and authorization-code with PKCE where appropriate; avoid deprecated or insecure flows.
Hands-on exercise: classify six requests without writing code
Write Authentication, Authorization, or Both beside each situation before checking the answers.
| Situation | Expected answer | Reason |
|---|---|---|
| Confirm which person signed in to a study app | Authentication | OIDC establishes identity |
| Read that person’s calendar with consent | Authorization | OAuth grants scoped API access |
| Sign in, then fetch a calendar event | Both | Identity and API permission are separate |
| Validate an ID token’s audience and signature | Authentication | Confirms the token is meant for this client |
| API checks whether an access token has read scope | Authorization | Enforces permission at the resource |
| Show a user’s name from an unverified JWT string | Neither safely | Unvalidated data is not reliable identity proof |
This original exercise is designed to reveal conceptual misunderstandings. For a production system, follow the identity provider’s official developer tutorials and security testing guidance.
Which should you learn first?
If you’re a beginner, learn authentication vs authorization first, then OAuth permissions and scopes, then OIDC and ID-token validation. After that study sessions, cookies, CSRF, PKCE and API authorization. This sequence helps you understand why one protocol alone cannot answer every login-and-access question.
Start with Course Centrals’ Authentication vs Authorization explainer. For related security foundations, read Hashing vs Encryption and the Google Cybersecurity Certificate guide.
Frequently asked questions
Is OpenID Connect a replacement for OAuth 2.0?
No. OIDC builds on OAuth 2.0 to add standardized authentication and identity information.
Can OAuth 2.0 authenticate users?
OAuth 2.0 is an authorization framework. It is not a complete interoperable authentication protocol by itself; use OIDC or another suitable authentication protocol when your app needs user identity.
Is an ID token the same as a JWT?
OIDC ID tokens are JWTs, but not every JWT is an ID token. A JWT’s structure alone does not establish its purpose or validity.
Why do apps need an access token after sign-in?
Sign-in identifies the user; access tokens authorize requests to protected resources when the app needs to call APIs.
Does OpenID Connect require sharing a password with the app?
No. With a properly designed OIDC sign-in, the identity provider handles authentication, and the client receives a validated identity assertion rather than the user’s password.
Is OAuth 2.0 the same as single sign-on?
No. OIDC can enable federated sign-in and SSO using OAuth-based flows; OAuth authorization alone is not the same as a complete SSO system.
Official sources and further learning
- OpenID Foundation: How OpenID Connect Works
- Microsoft Learn: Authentication vs Authorization
- Microsoft Learn: OpenID Connect on the Microsoft identity platform
- Okta Developer: OAuth 2.0 and OpenID Connect
