part 2OAuth 2.1 from scratch·lesson 2.3 of 10·2 min read
Access tokens, refresh tokens and Bearer
Not all tokens are the same or serve the same purpose. This lesson explains the difference between an access token and a refresh token, how to read a token endpoint response, what "Bearer" means, opaque vs. JWT tokens, and the audience that binds each token to one MCP server.
In this lesson
Know what each type of token is for and where it is sent.
Read a response from the token endpoint.
Explain what "bearer" means and what the audience is.
Access token vs. refresh token
Access token
Refresh token
Purpose
Access the resource
Obtain new access tokens
Sent to
The MCP server, on every request
Only the authorization server (token endpoint)
Typical lifetime
Minutes or hours
Days, weeks or until revoked
If it leaks
Damage limited in time
Serious: it can mint access tokens (hence rotation)
token_type: "Bearer": it will be used in Authorization: Bearer ….
expires_in: lifetime of the access token in seconds (here, 1 hour).
scope: the permissions actually granted (they may be fewer than those requested).
What "Bearer" means
A Bearer token works like a concert ticket: the doorman does not check who you are, only that the ticket is good. If it is stolen, the thief gets in. Consequences:
Always over HTTPS.
Never in the URL (logs, history, the Referer header).
Short lifetime to limit the damage.
Opaque vs. self-contained tokens
An access token can be opaque (a random string with no meaning; the RS asks the AS what it means, which is called introspection) or self-contained, usually a JWT (it carries the data inside plus a signature). See lesson 2.10. For the client it makes no difference: the client must never interpret the access token, only send it.
Audience
A token is issued for a specific recipient: its audience. A token for MCP server A must not be valid on server B. In MCP this is achieved with the resource parameter (see lesson 3.7) and the server's obligation to check it.