Installation guide · Sign-in and tokens
API tokens for programs
Let programs sign in with a personal API token in place of a browser.
A program, such as a script your search team runs, signs in with a personal API token instead of a browser. A signed-in user chooses API tokens from their account button, names the token, picks how long it lasts and copies it. The page shows it once. The program sends it on every request:
curl -H "Authorization: Bearer <token>" https://sequences.example.org/api/jobs
https://sequences.example.org/api/openapi.json describes the routes a program can use, in OpenAPI 3.1. It is open without sign-in and holds no data. POST /api/batches starts up to 100 searches in one request.
- A token acts as the person who made it, under the same rules, checked on every request. Taking someone off the invite file, or their domain off
BIOSEQUENCE_ALLOWED_DOMAINS, stops their tokens at the program's next request. - The group claim is read only at a browser sign-in. With
BIOSEQUENCE_OIDC_REQUIRED_GROUPset, a token keeps the groups its owner had when it was made, so when someone leaves the group, revoke their tokens on the usage page. - A token lasts at most
BIOSEQUENCE_TOKEN_DAYSdays, 90 by default, and each person may have 10 at a time. The service keeps only a SHA-256 hash of each token, in/data/tokens.json, so nobody can read one back. - A token cannot make another token: that needs the browser.
BIOSEQUENCE_TOKEN_DAYS=0turns tokens off and stops every token at once. Turned on again, tokens that have not expired work again, so to end tokens for good, revoke them.- A request with a token skips the browser's cross-site checks, which protect the cookie a browser sends by itself. It still has to name an allowed host.
With sign-in off there are no tokens: a program on the same machine calls http://127.0.0.1:8765 as the page does.
Guide version 1.63.0 · For Sequences 0.155.0