Protocol practice · Federation & Identity Standards
OAuth 2.0: the authorization code flow, with PKCE
Objective: You’re building Lumen Notes, which shows a user’s calendar events. Get permission to read their calendar and fetch today’s events, without ever seeing their password.
- 1Ask for access
- 2Handle the callback
- 3Swap the code
- 4Keep the tokens
- 5Call the API
Where OAuth fitsNot sure? Which protocol?
AccessWhat may this app do?
OAuthYou are here
AccountsDoes the account exist?
OAuth at work, every day
Each of these asks you to approve a limited token, never your password.
- A scheduling app reads your calendarRead access to events, nothing else.
- A chat integration posts to a channelWrite access to one place, revocable any time.
- A backup tool copies your filesLong-running access, renewed with a refresh token.
Step 1 of 5
Send the user to sign in
Your app builds a link to the authorization server and sends the browser there. Four values in it are yours to choose.
GET https://auth.example/authorize?response_type=______&client_id=lumen-notes&redirect_uri=https://notes.example/callback&scope=______&state=______&code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM&code_challenge_method=______
Fill in the four blanks, then send the request.
Pick an answer for each blank to continue.