Bookmarks

OAuth 2.0

An open delegated authorisation protocol: an application gets limited access to a user’s data on another service without being given the password.

Also: OAuth, OAuth2

checked 9 Nov

All terms

“Sign in with Google”, an app’s access to files in cloud storage, one service’s integration with another’s API — almost always OAuth is behind it. The key idea: the user does not hand the password to the application but confirms access on a trusted server, which issues the application a token with limited rights and a lifetime. The protocol is described in RFC 6749 (2012).

How it works

The protocol has four roles. The client never sees the resource owner’s password: the owner authenticates at the authorisation server, and the client receives a one-time code that it exchanges for tokens.

RoleWho it is
Resource ownerthe user or system that owns the protected data; it grants the permission
Clientthe application that needs access: a website, mobile app or server application
Authorisation serververifies the owner and their consent, and issues tokens
Resource serverthe API holding the protected data; accepts requests that carry a token

What comes out

An access token is a string, usually opaque to the client; it records the scopes of access and the period for which permission was granted. A response to a token request looks like this:

json
{  "access_token": "8Q1mYz7nTxBwRk4VcPd2Aa",  "token_type": "Bearer",  "expires_in": 3600,  "refresh_token": "tGzv3JOkF0XG5Qx2TlKWIA"}

After an hour (expires_in: 3600) access expires; it can be renewed with a refresh token without troubling the user again. The way a client obtains permission is called a grant type:

  • authorization code — the main one for web applications: the user confirms access in the browser, and the client receives a code and exchanges it for a token
  • client credentials — no user involved: a service calls another API on its own behalf
  • device code — for devices without convenient input: a TV shows a code, and the user confirms it on a phone

Not authentication

OAuth answers the question “what may this application do with someone else’s data”, but does not say who is on the other end: a token proves a right of access, not an identity. Building sign-in on an access token alone is unsafe — that is what OpenID Connect (OIDC) is for, a layer on top of OAuth 2.0 that adds an ID token carrying information about the user. The standard’s successor is OAuth 2.1: as of November 2026 it is an IETF working group draft that merges OAuth 2.0 with accumulated best practice and makes PKCE protection mandatory for the authorization code flow.

Sources

the term is written from these pages

Verified 9 Nov

Not to be confused with

what it is mixed up with and how it differs

  • OIDCOpenID Connect

    OIDC builds authentication on top of OAuth 2.0: it adds an ID token and tells you exactly who signed in; OAuth itself is only about access.

  • JWTJSON Web Token

    A JWT is only a token format: OAuth issues and uses tokens but does not require them to be JWTs.

In depth in the references

where the topic is covered in detail