Antonio Braccolino, Identity & Access, home
EN · Language: English

IAM interview questions · Protocols

What is the difference between OAuth 2.0 and OpenID Connect?

In plain wordsOAuth is the valet key: the attendant can drive your car, not open the boot. OIDC adds an ID card saying who handed over the key.

How it works

OAuth 2.0 (RFC 6749) is a framework for delegated authorization: a client gets an access token to call an API on behalf of a user, limited by scopes. The access token is meant for the API, and the client is not supposed to read it.

OAuth says nothing standard about who the user is. Using an access token as proof of login led to real vulnerabilities (a token issued for app A replayed into app B). OpenID Connect fixes this: with scope=openid the client also receives an ID token, a JWT for the client with iss, sub, aud, exp, nonce, plus a userinfo endpoint and discovery.

A concrete example

“Sign in with Google” on a recipe site is OIDC: the site needs to know who you are, it reads the ID token. If the same site also wants to save recipes into your Google Drive, it asks the scope drive.file and uses the access token against the Drive API: that part is OAuth.

Mistakes to avoid

  • Saying “we use OAuth for login” without mentioning OIDC.
  • Sending the ID token to APIs as if it were an access token.

They may also ask you

  • What does the openid scope change in the response?
  • Why should a client not parse the access token?