Volley / OAuth sequence diagrams
ExamplesOAuth 2.0 sequence diagrams that show the actual requests.
Most OAuth diagrams show boxes and arrows and leave out the part you need: what each redirect carries and what the token endpoint returns. These two include it. Open either one in the editor and change it to match your provider.
Authorization code with PKCE
The flow for web and mobile apps that sign users in. The app never sees the password, and PKCE ties the code to the app that asked for it.
What each step carries
- The app prepares. It generates a random
stateand acode_verifier, and hashes the verifier into acode_challengewith SHA-256. - The browser is sent to the authorize endpoint. The query has
response_type=code,client_id,redirect_uri,scope,state,code_challengeandcode_challenge_method=S256. - The user signs in and consents on the auth server's own page.
- The auth server redirects back to the callback with a short-lived
codeand the samestate. The app rejects the response ifstatedoes not match. - The app exchanges the code. A form-encoded
POST /tokenwithgrant_type=authorization_code, the code, the redirect URI and the originalcode_verifier. - The token response. On success, a JSON body with
access_token,token_type,expires_in, and oftenrefresh_tokenandid_token. On an expired or reused code, a 400 withinvalid_grant. The diagram shows both as anif/else. - The app calls the API with
Authorization: Bearerand the access token.
In the editor every one of those payloads is one click away: select an arrow to see its parameters as a table or as the raw body.
Client credentials
The machine-to-machine flow. A backend service trades its own credentials for a token, with no user and no browser.
- Token request.
POST /oauth2/tokenwithgrant_type=client_credentials, the client id and secret, and the scopes it needs. - Token response. A bearer token with a short lifetime. There is no refresh token in this flow; the service asks again.
- API call. The token goes in the
Authorizationheader.
Check them against your provider
Providers differ in small ways that break clients: a string where you expected a number, a missing scope, a 401 instead of a 400. Record a real sign-in in your browser and run Drift Check on the diagram. Our client credentials demo catches exactly that kind of drift.
More sign-in flows
Templates for Sign in with GitHub and SAML single sign-on show the same level of detail for those protocols.
Write your own
Each diagram is a short text file. An arrow is App -> Auth Server: POST /token; the lines under it starting with in: and out: hold the request and response. The syntax guide covers notes, branches, dividers and icons.