What is a bearer token?
A bearer token is an access token that grants access to whoever presents it; possession is the only proof. RFC 6750 defines how to send one: in the Authorization header, after the word Bearer. API keys, OAuth access tokens and Intraface's ifc_ agent tokens all qualify, so anyone who copies one can act as you until it is revoked.
Part of Glossary: the terms behind MCP, coding agents and shared pages, defined plainly.
The agent gets a token: an OAuth sign-in hands it one, or you create one in a settings page and paste it into the agent's config or environment.
On every request the agent adds the header Authorization: Bearer followed by the token. OAuth 2.1 forbids putting it in the URL query string.
The service checks the token: is it valid, was it issued for this service, and does it carry the scope this call needs.
No or bad token: 401 Unauthorized with a WWW-Authenticate: Bearer challenge. Valid token, missing scope: 403 with error=insufficient_scope.
Revoking the token on the service's side ends the agent's access at once, without touching the machine it runs on.
Source: RFC 6750: The OAuth 2.0 Authorization Framework: Bearer Token Usage
Bearer token versus API key
Both are strings you present to get in. The difference is in how they are born and how they die. An API key is created by a person in a settings page, copied into a config file or an environment variable, and lives until someone remembers to rotate it. An OAuth access token is issued by an authorization server after you approve a client, often expires within an hour, and can be refreshed or revoked without anyone editing a file. On the wire they look the same: the Authorization header, the word Bearer, then the string. RFC 6750 defines the term for both. Possession is the only credential, which is why the spec insists on TLS, short lifetimes, and keeping the token out of anything that gets logged.
Example: an agent that cannot open a browser
Some agents cannot finish a browser sign-in, so Intraface lets you create a token by hand under Settings, then Agents. You give it a label, pick its scopes, optionally limit it to certain boards, and copy it once; it begins with ifc_ and you will not see it again. The agent sends it on every request as Authorization: Bearer ifc_... and the server treats that agent as you, within the scopes you chose. The same kind of ifc_ token is what the OAuth flow hands out when the browser step works, so the two paths differ only in how the token reaches the agent. You can revoke either from the same page, and a token nobody has used for 90 days stops working on its own.
Why it matters
A bearer token is the simplest possible credential, and that is also its danger. There is no second factor, no device binding, no proof that the sender is the party the token was issued to. Whoever reads it has it. The MCP authorization spec adds two rules on top of RFC 6750 for exactly this reason: a server must check that a token was issued for it and not for some other service, and it must never forward a token it received on to another API. A token that drifts past the service it was meant for is how the confused deputy problem starts.
Common mistakes
- Putting the token in the URL. RFC 6750 allowed a query parameter and told you not to use it; OAuth 2.1 forbids it. URLs end up in browser history, proxy logs and referrer headers.
- Committing it. A token in a checked-in config file is a token on every clone. Use the agent's environment-variable or secret-input syntax instead of the raw string.
- Reading 401 and 403 as the same error. 401 with a WWW-Authenticate: Bearer challenge means there is no valid token: sign in again. 403 with error=insufficient_scope means the token is fine but lacks a permission: ask for a wider scope.
- Issuing tokens that never expire. RFC 6750 recommends an hour or less for access tokens. A long-lived token needs revocation and idle expiry to make up for it.
FAQ
- Is an API token the same as a bearer token?
- Usually. Most API keys are sent as Authorization: Bearer and meet RFC 6750's definition: whoever holds one can use it. The difference is lifecycle, not transport. An API token is created by a person and lives until rotated; an OAuth access token is issued after an approval and is often short-lived.
- Where should a bearer token never go?
- Not in a URL query string, which OAuth 2.1 forbids outright because URLs land in browser history, proxy logs and referrer headers. Not in a config file that gets committed. Not in logs. RFC 6750 also rules out cookies that can travel without TLS.
- How long should a bearer token live?
- RFC 6750 recommends short lifetimes for access tokens, an hour or less, so a leak does limited damage. Long-lived API tokens trade that safety for convenience, which is why they need revocation and idle expiry: a way to kill one now, and a rule that kills one nobody has used for a while.
Stop sending HTMLover Slack.
Create an account in a minute, connect your coding agent, and make your first board.