PAD Showcase
All tags/Diagram

Signing in with a provider

A sequence diagram - lifelines, numbered messages, replies dashed, an alt frame with its else and a note.

1 The tag diagram/login.pad pad
{diagram type='sequence', title='OAuth sign-in'}
  actor U as User
  participant B as Browser
  participant A as App
  participant P as Provider
  autonumber
  U ->> B: Sign in
  B ->> P: Authorize
  P -->> B: Redirect with a code
  B ->> A: GET /callback
  A ->> P: Exchange the code
  alt Code is valid
    P -->> A: Access token
    A -->> B: Signed in
  else Expired
    A -->> B: Try again
  end
  Note over A,P: The token never reaches the browser
{/diagram}
2 The result rendered on the server
OAuth sign-in User to Browser: Sign in; Browser to Provider: Authorize; Provider to Browser: Redirect with a code; Browser to App: GET /callback; App to Provider: Exchange the code; Alt: Code is valid; Provider to App: Access token; App to Browser: Signed in; Else: Expired; App to Browser: Try again; Note: The token never reaches the browser User User Browser Browser App App Provider Provider alt [Code is valid] [Expired] User → Browser: Sign in 1. Sign in Browser → Provider: Authorize 2. Authorize Provider → Browser: Redirect with a code 3. Redirect with a code Browser → App: GET /callback 4. GET /callback App → Provider: Exchange the code 5. Exchange the code Provider → App: Access token 6. Access token App → Browser: Signed in 7. Signed in App → Browser: Try again 8. Try again Note: The token never reaches the browser The token never reaches the browser