Confidential vs public OAuth clients, and why implicit was retired

Confidential clients keep a secret on a server; public clients can't, so PKCE stands in. And why the implicit flow was retired.

archhyOAUTH 2.0 AND OPENID CONNECT, DRAWN OUT·LESSON 3
ARCHHY PRESENTS

Confidential vs public OAuth clients, and why implicit was retired

Confidential clients keep a secret on a server; public clients can't, so PKCE stands in. And why the implicit flow was retired.

0:00 / 3:01

Diagrams in this video · 2Free in archhy

Copy and edit in archhy: A confidential client (new tab)
Copy and edit in archhy: The implicit flow, retired (new tab)

After this lesson you can

  • Tell a confidential client from a public client
  • Walk the confidential client flow on the diagram
  • Explain why a public client can't hold a secret
  • Explain why the implicit flow was retired
Transcript

Confidential vs public OAuth clients, and why implicit was retired

Space Llama here. Every OAuth client has an ID. The question that changes the flow is whether it can also keep a secret. Today: confidential clients, public clients, and the flow we retired.

A confidential client

A confidential client runs on a server you control, like a traditional web app's backend. One. Your browser goes to the authorize endpoint, with the client ID, a state, and a PKCE code challenge, the Proof Key for Code Exchange from lesson two. Two. You log in, approve, and the browser is redirected back with a one-time code. Three. The code lands at the web app's backend, on its callback address. Four. The backend sends the code, its client secret and the verifier to the token endpoint. Only this server knows the secret, so the authorization server knows the right app is redeeming the code. Five. The tokens stay on the server. Your browser only ever gets a session cookie.

Secret or no secret

A public client is anything that runs on the user's device: a single-page app, a mobile or desktop app, or a command-line interface. Anything shipped to a device can be unpacked. So it can't keep a secret. It uses the same flow, with PKCE standing in for the secret. Client ID plus PKCE, no secret. And a confidential client should use PKCE too. The secret proves which app; PKCE ties the code to the request that started it.

The implicit flow, retired

Early single-page apps couldn't make cross-origin calls to a token endpoint. So OAuth offered a shortcut: the implicit flow. With response type token, the server skipped the code, and put the access token straight into the redirect address. That token in the address can leak, through browser history, logs and referrer headers. It can be injected by an attacker. And there's no back-channel step where PKCE or a secret could protect it.

What to use instead

RFC 9700 says clients should not use the implicit flow, and the OAuth 2.1 draft leaves it out altogether. Browsers now support cross-origin resource sharing, or CORS, so a single-page app can run the code flow with PKCE instead. Better still, a small backend for the frontend can keep the tokens off the browser entirely.

Remember

Let's recap. A confidential client keeps its secret and its tokens on the server. A public client runs on your device, so PKCE stands in for the secret. The implicit flow put the token in the address, and it's retired. Everyone uses the code flow with PKCE.

Your turn in archhy

Open these flows in archhy and change them for your own system. The link is below, with archhy's full article. Next lesson: no user at all, TVs and command lines, and refresh tokens. See you there.

Draw it in archhy

Open this lesson's diagram in archhy, ready to change for your own system. Free, in the browser.