Also available: Markdown version · llms.txt · full site content
Authentication
Sessions and tokens
Access tokens live for one hour; refresh tokens for 30 days and rotate on every refresh. Reusing a replaced refresh token revokes the whole family.
The token pair
| Token | Format | Default lifetime | Use |
|---|---|---|---|
accessToken | HS256 JWT | 1 hour | Bearer token on Data API and user endpoints |
refreshToken | Opaque, stored hashed | 30 days | Exchange for a new pair; never sent to the Data API |
The access token’s claims include sub (the user id), email, session_id, amr (how the session authenticated: pwd, mfa, oauth, or empty for anonymous), and the expiry. Both lifetimes are configurable per project.
The session lifecycle
Email and password return an access JWT and a refresh token.
accessToken · 1 h
A new pair is issued and the old refresh token is retired.
refreshToken · rotates
A retired token presented again revokes the whole family.
family revoked
Logout or a Console revoke fails the session on the next request.
session_revoked
Refreshing
POST https://example-project.api.cubibase.com/auth/v1/token?grant_type=refresh_token
apikey: cb_pub_EXAMPLE_ONLY
Content-Type: application/json
{
"refreshToken": "<REFRESH_TOKEN>"
}- A refresh issues a new access token and a new refresh token, and retires the old one.
- The session id stays the same across refreshes, so the Console shows one session, not dozens.
- Store the new pair atomically: the old refresh token is dead the moment the response arrives.
Revocation is immediate
Every Data API request checks that the session behind the token is still live and the user is not banned. Revoking a session (logout, or the Console’s Sessions screen) or banning a user takes effect on the next request — not when the access token expires.
POST https://example-project.api.cubibase.com/auth/v1/logout
apikey: cb_pub_EXAMPLE_ONLY
Content-Type: application/json
{
"refreshToken": "<REFRESH_TOKEN>"
}| Situation | Next request returns |
|---|---|
| Session revoked | 401 session_revoked |
| User banned | 403 user_banned |
| Project requires MFA, session lacks it | 401 mfa_required |
| Access token expired | 401 invalid_token |