Skip to content
BENIBIX Learn

Bearer Token

Development🔑 AuthSessions and Tokens

Also known as Bearer, Bearer Authentication, Authorization: Bearer

A token that works for whoever holds it. It is sent in a header.

Think of it like

Think of it like cash. Whoever holds the note can spend it, no questions asked.

Example

Jack's script sends Authorization: Bearer with his token. Copied to a stranger's machine, the same line would work just as well.

Why it matters

Most web APIs use bearer tokens, so knowing the header is how you call them.

Definition

A bearer token is an access token that works for whoever holds it, with no other proof. It is sent in a header that reads Authorization: Bearer, followed by the token. The server checks the token itself, not who sent it. That makes it simple to use, but a stolen one works just as well for the thief. So bearer tokens are only ever sent over HTTPS.

Example code

console
$ curl -H "Authorization: Bearer $TOKEN" https://api.example.com/orders
The token travels in the header, and holding it is the only proof.

Common mistake

Sending a bearer token over plain HTTP. Anyone on the network can read it and use it.

Key takeaways

  1. 1
    Holder wins. No other proof.
  2. 2
    In a header. Authorization: Bearer.
  3. 3
    HTTPS only. Or it can be read.