Skip to content
BENIBIX Learn

Access Token

Development🔑 AuthSessions and Tokens

Also known as Auth Token, Token

A string an app sends with each request to prove it may use an API.

Think of it like

Think of it like a pool wristband. It lets you in for one hour.

Example

Lucy's phone app logs her in and gets an access token. For the next hour, every request carries that token instead of her password.

Why it matters

Apps never have to store or resend your password. A short-lived token limits the harm if it leaks.

Definition

An access token is a string an app sends with each request to prove it may use an API. You get it after logging in, and it stands in for your password from then on. Most access tokens expire quickly, often within an hour. The server checks the token on every request before it answers. Anyone who holds a valid token can use it, so it must be kept secret.

Example code

http
GET /api/orders HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9...
The token rides in a header, after the word Bearer.

Common mistake

Saving access tokens where page scripts can read them, like localStorage. One XSS bug then hands them over.

Key takeaways

  1. 1
    Proof on each request. Instead of a password.
  2. 2
    Short-lived. Often an hour.
  3. 3
    Keep it secret. Holding it is enough.

Compare

Learn it properly