Accounts and access
2. Authentication schemes
Every authenticated route reads one header:
Authorization: Bearer <token>
There are several kinds of token. Each kind opens a different set of routes.
| Credential | Format | Lifetime | How it is obtained | What it opens |
|---|---|---|---|---|
| Session access token | A signed JWT (HS256) | 1 hour | POST/v1/accounts/login, POST /v1/accounts/token/refresh, or the SSO device flow |
Every account, key-management, organisation and administration route in this document. Also accepted by the graph endpoints POST /v1/live, POST /v1/live/{tool}, GET /v1/live/tools and POST /v1/live/mcp. |
| Session refresh token | glr_ + 43 URL-safe characters |
30 days, single use | Returned with every access token | Only POST /v1/accounts/token/refresh (and, optionally, POST /v1/accounts/logout). |
| API key (live key) | glk_ + 43 URL-safe characters |
No expiry unless one is set (expiresAt); valid until it expires or is revoked |
POST/v1/graphs/{graphId}/keys |
The graph endpoints POST /v1/live, POST /v1/live/{tool}, GET /v1/live/tools and POST /v1/live/mcp, limited to the key's graph and scope; and, when its scope names them, the key routes of the integration API (change feed, export, extraction, webhooks, rotating its own secret). It does not open any account, organisation or administration route. |
| OAuth access token | glo_ + 43 URL-safe characters |
30 days | The OAuth 2.1 authorization-code flow (section 8) | The same graph endpoints as an API key (not the key-only integration routes), limited to the graphs and access level the user approved. |
| OAuth refresh token | glr_ + 43 URL-safe characters |
No expiry of its own; single use, rotated on every refresh, valid until used or revoked | Returned with every OAuth access token | Only POST /oauth/token with grant_type=refresh_token. |
Notes that apply to all of them:
- Secrets are shown once, in the response that creates them. The server stores only a SHA-256 hash, so a lost token cannot be recovered; mint a new one, or, for an API key, rotate it (section 7.5).
- The session access token is a JWT signed with the server's
JWT_SECRET. Its claims aresub(account id),jti(session id),device_id,iss(graphlife),aud(graphlife-app),iatandexp. The server also checks, on every request, that the session named byjtihas not been revoked, so logging out or changing the password takes effect immediately rather than when the JWT expires. - Session refresh tokens and OAuth refresh tokens share the
glr_prefix but are different credentials and are accepted only by their own endpoint. - Two further token kinds exist for app-specific features and are summarised in section 12: share-grant keys (also
glk_) and inbox tokens (glin_).
2.1 Who may call what#
The role columns in this document use these terms:
| Term | Meaning |
|---|---|
| Public | No credential required. |
| Session | A valid session access token for any active account. |
| Graph owner | The account that owns a personal graph. |
| Org member | A session whose account belongs to the organisation, in any role (owner, admin, member, guest). |
| Org admin | A session whose role in the organisation is owner or admin. |
| Org owner | A session whose role in the organisation is owner. |
| Instance owner | The oldest account on the server (the first one created). There is no separate server-administrator role and no server-administrator API; the only special power of the instance owner is that organisation invites they issue can admit new accounts when sign-up is restricted (sections 6.1 and 9). |
2.2 Re-authentication#
Some sensitive routes require proof that the caller is the account holder now, not merely the holder of an access token. They accept it in the request body:
- A password account sends its password in the
passwordfield (in the same form it uses to log in; see section 6.2). - An SSO-only account has no password. The request succeeds only if the session's original sign-in at the identity provider happened within the last 5 minutes. Refreshing a token does not reset that clock.
The routes that require it are: DELETE /v1/accounts/me, POST /v1/accounts/me/export, POST /v1/accounts/identities, DELETE /v1/accounts/identities and POST /v1/orgs/{orgId}/export.
A failed re-authentication is reported differently by the two families: the account deletion and the two exports answer 401 unauthorized; the two identity routes answer 403 reauth_required.
POST /v1/accounts/password is separate: it always requires the current password, in its own currentPassword field.