IAM interview questions · Protocols
ID token or access token: who reads which?
In plain wordsThe ID token is the name badge the app reads. The access token is the ticket the API checks at the door.
How it works
The ID token is always a JWT, its audience (aud) is the client_id, and it tells the client who authenticated, when and how (sub, auth_time, acr, amr). The client validates it and builds its session from it.
The access token is for the resource server. It can be a JWT or an opaque string checked with introspection. Its audience is the API, and it carries scopes and sometimes roles. The API validates it on every call.
Rule of thumb: the ID token goes to the client and stays there; the access token is forwarded to APIs and the client treats it as opaque.
A concrete example
A mobile app receives both. It reads the ID token to show “Hi, Sara” and store sub as user key. It calls GET /orders with Authorization: Bearer <access token>. The orders API rejects any token whose aud is not “orders-api”, including the ID token, whose aud is the mobile app’s client_id.
See it in action: who the ID token is for
Mistakes to avoid
- Not checking aud, so a token for another API is accepted.
- Putting sensitive personal data in tokens that travel through browsers.
They may also ask you
- When would you use opaque tokens and introspection?
- What claims would you check in an ID token?
- Go deeper
- ID token →
- Access token →