0
How Authorization Code Flow Works (Confidential Clients)

Unlike public clients (SPAs), confidential web applications possess a private backend server. This architecture splits the flow cleanly into two distinct communication channels:

  1. Front-Channel User Redirection (GET /authorize): The user clicks "Sign In" in your application. The browser redirects to the IdP's login portal with response_type=code, client_id, and a cryptographic state token. The user enters credentials, performs MFA, and grants requested permissions.
  2. Authorization Code Handover: Upon successful authentication, the IdP redirects the user's browser back to the application's backend redirect_uri, passing an ephemeral authorization code in the query string. This code is single-use and expires in minutes.
  3. Back-Channel Direct Token Exchange (POST /token): Your backend web application intercepts the incoming code and initiates a direct, machine-to-machine HTTPS POST to the IdP's token endpoint, authenticating itself with its private client_secret.
  4. Token Security & Session Creation: Because tokens are delivered directly to your backend server over a TLS-encrypted back-channel, the browser never sees the access or refresh tokens. Your server creates an HTTP-only, secure session cookie for the user, rendering the flow immune to browser XSS token-theft attacks.
  5. Token Decoding & Claims: The application validates the cryptographic signature of the id_token and extracts user profile claims (sub, email, name) to initialize the local user session.
1
Client & IdP Configuration

Configure your confidential application credentials. The client secret is transmitted strictly to our serverless proxy (/api/token-exchange) to execute the token POST and is never saved in persistent storage.

The IdP user login URL where the browser initiates the authentication dance.
The IdP back-channel REST endpoint where the backend redeems the authorization code.
The Application ID registered with the IdP as a Web / Confidential application.
The private credential proving the authenticity of your application's backend server.
Must match an allowed Redirect URI configured in your IdP application registration.
openid requests the ID Token; profile and email request identity claims.
2
Authorization Request (Browser Redirect)

The user's browser redirects to the IdP's authorization endpoint. Unlike PKCE, no code_challenge is passed in the URL because the confidential client's private secret will prove its identity directly at the token endpoint.

GETBrowser Redirect
// Fill in config above
3
Authorization Code Received

Following user authentication, the IdP redirects back to the redirect_uri with a short-lived code in the query string. In a real application, this code is caught by your server-side route handler.

REDIRECT RESPONSE · URL Query Params
// Awaiting redirect from IdP…
4
Token Exchange (via Backend Proxy)

Your backend sends the authorization code, client ID, and private client secret in an HTTP POST to the IdP's token endpoint. Our proxy (/api/token-exchange) simulates this server-to-server call and returns the exact HTTP wire log.

POST/api/token-exchange → (proxied to IdP)
// Preview will appear after IdP redirect

Exact HTTP Request sent by Backend to IdP

// Will appear after exchange

IdP Token Response

// Awaiting token exchange…
5
Token Decoding & Claims Inspection

Explore the contents of the returned tokens. The id_token contains verified user identity claims, while the access_token authorizes server-side API requests.

// Decoded tokens will appear here after exchange