OAuth2 vs OIDC

 The core difference is that OAuth 2.0 is an authorization framework, while OpenID Connect (OIDC) is an authentication layer built on top of it.

Think of OAuth 2.0 as a key card that grants you access to specific rooms in a hotel (the resources), and OIDC as the ID badge that actually identifies who you are.

1. Primary Purpose

  • OAuth 2.0: Designed to provide Delegated Access. It allows a third-party application to access a user's data (like photos or contacts) without needing the user's password. It answers the question: "What is this application allowed to do?"

  • OIDC: Designed for Identity. It sits on top of OAuth 2.0 to provide information about the user. It answers the question: "Who is the user, and how did they log in?"

2. The Token Types

The most visible difference in the protocol flow is the type of tokens issued:

  • OAuth 2.0 issues an Access Token: This is usually an "opaque" string or a JWT intended for the Resource Server. It doesn't necessarily contain user info; it just proves the bearer has permission to access an API.

  • OIDC issues an ID Token: This is always a JSON Web Token (JWT). It contains claims about the user (like their name, email, and the time they logged in)




Comments

Popular posts from this blog

Agentic AI Course : Week 1

LLM Engineering course : Day 1

LLM Engineering : Week 2