13 API keys
For programs that can only send a fixed header. Off unless the application turns them on, and not recommended: a device key (07) or a connected app (08) does the same without a secret that can be copied.
Form
<prefix><secret>. The prefix matches ^[a-z][a-z0-9_]{0,14}_$, belongs to the application and never changes, so that
scanners find keys. The secret is 256 random bits in base64url, 43 characters. No other token has this length with the
prefix. The server stores SHA-256 of the whole text.
Creation
- It needs the user in person, with a fresh login. The application decides who may, and for which scopes.
- Name, scopes and lifetime are required. The lifetime is at most 90 days†. An implementation refuses a longer one and does not shorten it. Use does not extend it, and there is no renewal.
- Scopes come from the list of the application, which is not empty.
- The secret is in the answer once.
Use
- Only
Authorization: Bearer. Never a URL, a cookie or a body. - The level is
api_key, the binding isbearer, and there is no time of a proof. It is not first-party, not fresh, and not a connected app. An account API never accepts it. - Scopes that the application no longer offers are not given.
- The record gets the time and address of the use at most every five minutes. A new address makes an event.
- A policy that needs key-bound sessions refuses every API key. So does an application that turned them off.
End
A key ends with its lifetime, when its user ends it, with “log out everywhere”, a recovery or the undo of one, and when the user is disabled. Ending it needs no fresh login and works while the key is in use.