Step by step: PKCE sign-in
- The user clicks Sign in. The SPA creates a code_verifier and derives its code_challenge.
- The SPA sends the browser to the authorization server with the code_challenge and a state value.
- The browser requests /authorize with the code_challenge and state.
- The authorization server shows its login and consent page.
- The user signs in and approves consent.
- The authorization server redirects the browser back with a one-time code and the state.
- The browser loads the /callback route in the SPA with the code and state. The SPA checks the state.
- The SPA posts the code and the code_verifier to the token endpoint.
- The authorization server checks the verifier against the challenge and returns the tokens.
- The SPA makes its first API call with the access token as a Bearer token.
- The API validates the token and returns the user profile. The user is signed in.