Skip to content
StackDecode
System Design
13. Security ArchitectureAnimated

OAuth 2.0

Delegating limited access without sharing passwords.

The idea

A user grants an app a token with limited scopes via an authorisation server.

Watch it work

Press play, pause, or step through. Some animations have settings you can change.

UserAppAuth serverResource APIclick "Sign in with X"
  • current message
  • earlier
  • failure or attack

The user starts in the app.

step:
1/8
from:
User
to:
App
1/8

Time runs downward. Solid arrows are requests, dashed arrows are replies.

Step by step

  1. 1App redirects the user to the provider
  2. 2User consents
  3. 3App gets a code and exchanges it for a token
  4. 4App calls the API with the token

Where it is used

Sign in with Google and API access.

Watch out for

OAuth is for authorisation. Use OIDC for login.

Related