Concepts / Identity

Identity

API authentication

Also called HTTP Basic, basic authentication, bearer token, API key, Authorization header, X-API-Key, 401, 403, token

How a program proves who it is to an API: a password on every request (Basic), a token it got once (Bearer), or a key.

A header says who is calling
A header says who is calling

Basic sends the password on every request, a bearer token is got once and expires, an API key is a long-lived secret. 401 means the API does not know who is asking; 403 means it knows and refuses.

API authentication is how a program proves who it is. HTTP Basic sends Authorization: Basic <base64 of user:password>: not encrypted, so it needs HTTPS. A bearer token is got once and sent as Authorization: Bearer <token>; it expires, but whoever holds it gets in. An API key is a long-lived secret in a header. 401 means the server does not know who is asking, 403 that it refuses.

See it on real machines

Read next

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Sign in with Google or email to start.

Start this lab