ID token or access token, signing out, and OIDC vs SAML
Which token goes where, the three OpenID Connect flows, one sign-out that tells every app, and when to choose OIDC, OAuth or SAML.
Diagrams in this video · 2Free in archhy
The diagrams, full size
Copy any of them into archhy, free, and change it for your own system.
After this lesson you can
- Send each token to the right place
- Choose between the three OpenID Connect flows
- Walk RP-initiated and back-channel logout
- Choose between OpenID Connect, OAuth and SAML
Transcript
ID token or access token, signing out, and OIDC vs SAML
Space Llama here, for the last lesson. Two tokens, two audiences, and the mistake almost everyone makes once. Then: signing out properly, and when to use which protocol.
Which token goes where
The token endpoint gives the app two tokens. They answer different questions, and they're addressed to different audiences. The ID token is addressed to your app: its audience is your client ID. Read it once at sign-in, then rely on your own session. Don't send it to an API. The access token is addressed to an API. The app should treat it as opaque, and just pass it on. Its format belongs to the provider and the API. And an access token alone is not proof of login. An app that signs people in with plain OAuth can be fooled by a token issued to a different app. That gap is why OpenID Connect exists.
Three OpenID Connect flows
OpenID Connect defines three flows, chosen by the response type. Authorization code: the tokens come from the token endpoint, on the back channel. Use it with PKCE, the Proof Key for Code Exchange, for every kind of app. Implicit puts tokens in the redirect, with the same leakage problems as OAuth's implicit flow. Best left alone. And hybrid sends an ID token in the redirect straight away, and a code to redeem later. You'll mostly find it in older enterprise setups.
One sign-out, every app told
Signing out of one app doesn't end your session at the provider, or in other apps that share it. Two companion specs fix that. One. You sign out in App A. Two. With relying party initiated logout, App A sends your browser to the provider's end session endpoint, with an ID token hint and where to come back to. Three. With back-channel logout, the provider posts a signed logout token to every other app's backend. It names the user or the session, so each app ends its own session, server side. Four. Your browser comes back to App A, signed out everywhere the provider told.
OIDC, plain OAuth or SAML?
So which protocol? Signing people in to your app: OpenID Connect. An app calling an API for a user: OAuth access tokens, usually from the same sign-in. Service to service, with no user: client credentials. There's no ID token, because there's no person. And enterprise single sign-on to existing business apps is often SAML 2.0, the Security Assertion Markup Language. It does the same job with XML. Most providers speak both, and new integrations usually choose OpenID Connect.
Remember
Let's recap. The ID token is for the app, never for an API. The access token is for the API, and the app doesn't read it. Use the authorization code flow with PKCE everywhere. And one sign-out can tell every app, with back-channel logout. That's OAuth 2.0 and OpenID Connect, drawn out.
Your turn in archhy
Open these flows in archhy and change them for your own system. The links are below, with archhy's full article. Thanks for watching Drawn Out. More courses are on the way. If you learned something, there's more on the channel. If you didn't, also the channel. Mate.
Draw it in archhy
Open this lesson's diagram in archhy, ready to change for your own system. Free, in the browser.






