Access tokens, ID tokens, and refresh tokens
Identify each token by who consumes it and what it authorizes or conveys.
An application can receive several tokens from one exchange. The recipient and purpose tell you which token belongs where.
| Token | Consumer | Purpose |
|---|---|---|
| Access token | Resource server | Authorizes requests to a protected resource subject to token and API policy |
| ID token | OpenID Connect client | Conveys claims about authentication and the end user |
| Refresh token | Authorization server | Lets an eligible client request a new access token under the existing grant |
At the resource server
Reading List presents its access token to the library API. The API checks whether the token is intended for it and allows reading the requested books. An OAuth access token can be opaque to the client. Its representation depends on the issuer and resource server.
At the OpenID Connect client
If Reading List also uses OpenID Connect for sign-in, it can receive an ID token. The ID token is a JWT issued for that client. The client verifies it according to the applicable OIDC flow, including the issuer, the audience that contains its client ID, expiry, and the nonce when sent. The ID token does not grant access to the library API.
At the token endpoint
An authorization server may issue a refresh token. The client presents it to the token endpoint after an access token expires or when it needs a new one. The authorization server validates the request and can refuse it if the grant has ended. It may replace the refresh token during use.
When an authorization server issues refresh tokens to public clients, the OAuth Security BCP requires sender-constraining or rotation to detect replay. With rotation, each successful refresh can replace the previous token and reuse can expose a compromised token family. RFC 9700 §4.14.2
Check your understanding
An ID token has a valid signature and an audience equal to Reading List’s client identifier. Can the library API use it as an access token?
Reveal the answer
The library API requires an access token issued for that API. The ID token
conveys authentication claims for Reading List.