OIDC Flow: "Authorization Code Flow" (with PKCE optional for public clients)
Absolutely. Here’s a concise explanation of the OIDC flow you implemented, plus a quick list of other standard OAuth2/OIDC flows for context.
Your OIDC Flow: "Authorization Code Flow" (with PKCE optional for public clients)
How it Works (Your MVP):
-
User visits client app (API Gateway) → clicks login
-
Client app redirects user to
/authorizeendpoint onidentity-backend, passing:-
client_id,redirect_uri,scope, andstate
-
-
Identity-backend shows login form.
-
User enters username/password, submits.
-
-
If login is successful:
-
Identity-backend creates a single-use authorization code and redirects back to
redirect_uri(your client) with?code=...&state=...
-
-
Client app receives the code, then POSTs to
/tokenendpoint onidentity-backendwith:-
code,client_id,client_secret,redirect_uri
-
-
Identity-backend checks everything is valid and issues a JWT (your
id_token), which the client stores (session). -
Client app now uses this token to authorize access to all protected endpoints.
Key Points:
-
Client never sees the user’s password.
-
Code is exchanged server-to-server for token (never exposed to browser or attacker).
-
This is the most secure and widely used flow for web apps and APIs.
Other OAuth2 / OIDC Flows (Just the Names)
-
Authorization Code Flow (what you implemented)
-
Implicit Flow (for old-school pure JS apps—not recommended anymore)
-
Client Credentials Flow (for server-to-server/API service auth)
-
Resource Owner Password Credentials Flow (ROPC—legacy, not recommended)
-
Device Authorization Flow (for devices without browser, e.g., TVs)
-
Hybrid Flow (mixes code + implicit, advanced)
-
Authorization Code Flow with PKCE (for public/native/mobile clients)
You are using #1, which is the gold standard for browser-based web apps!
Let me know if you want to see a diagram or the details on any of the others.
Comments
Post a Comment