Authentication & OAuth
Section titled “Authentication & OAuth”This page is for developers who need a credential the platform trusts: to sign people in to their own app, or to let a server or script call the API. You will find your tenant’s OpenID provider, get a client registered, run the right OAuth flow, call the API with the resulting token, and keep the session alive.
A token proves who is calling. What the caller may do is decided separately, by that user’s permissions in the tenant.
Pick a method
Section titled “Pick a method”| Your caller | Method |
|---|---|
| A person in your web or mobile app | Authorization code with PKCE |
| Your own server acting as itself | An API token owned by a dedicated application user. Not client credentials: that token has no user, so it can reach almost nothing |
| A script, service or automation tool with no person present | An API token — the simplest option |
| A trusted first-party script that holds a user’s password | The password grant |
| A visitor who is not signed in, on a public page | An anonymous token |
Choosing a credential explains the trade-offs in more depth.
Find your tenant’s OpenID provider
Section titled “Find your tenant’s OpenID provider”Every tenant has its own OpenID provider, with its own issuer, signing keys and clients. You reach it through the tenant’s host, so you never pass a tenant id.
-
Ask the tenant for its host, for example
https://acme.example.com. -
Read the tenant’s public configuration. It names the provider (
authority) and the web client the tenant’s own portal uses:Terminal window curl -s https://acme.example.com/api/identity/v1/tenant-config{"schemaVersion": 1,"appId": "<tenant-id>","authority": "https://<authority-host>","clientId": "<web-client-id>","scope": "<scopes-the-web-client-requests>"} -
Load the discovery document from the authority and take every endpoint from it — do not hard-code paths:
Terminal window curl -s https://<authority-host>/.well-known/openid-configuration
Most OAuth 2.0 / OpenID Connect client libraries need only the authority URL and do step 3 themselves.
Get a client registered
Section titled “Get a client registered”There is no self-service client registration. Ask the platform operator to register an OAuth client for your application, and tell them:
- whether it is a public client (a browser or mobile app, no secret, PKCE) or a confidential one (a server that can keep a secret);
- the grant types you need — authorization code with refresh tokens, client credentials, or the password grant;
- your redirect URIs and post-logout redirect URIs;
- the scopes you need, usually
openid email profile offline_access; - if you need it, a shorter or longer access-token lifetime for this client.
Redirect URIs must match exactly, with one exception: a single wildcard may stand
for a whole subdomain in the host name, such as
https://*.apps.example.com/auth-callback. A wildcard in the path, more than one
wildcard, a partial label such as *suffix.example.com, and a wildcard over a public
suffix such as *.co.uk are refused.
You receive a client_id, and for a confidential client a client_secret. Keep the
secret on the server only. (Operators register clients as described in
Identity server — OIDC clients.)
Sign users in (authorization code with PKCE)
Section titled “Sign users in (authorization code with PKCE)”This is the flow for any app where a person signs in. The hosted sign-in page handles passwords, passkeys, second factors and external identity providers for you.
-
Send the user to the authorization endpoint with a PKCE challenge:
https://<authority-host>/auth?client_id=<client-id>&response_type=code&redirect_uri=https://app.example.com/auth-callback&scope=openid%20email%20profile%20offline_access&state=<random-state>&code_challenge=<S256-challenge>&code_challenge_method=S256 -
Receive the code on your redirect URI, and check that
statematches. The code is valid for 10 minutes. -
Exchange it for tokens at the token endpoint:
Terminal window curl -s -X POST https://<authority-host>/token \-d grant_type=authorization_code \-d code=<code> \-d redirect_uri=https://app.example.com/auth-callback \-d client_id=<client-id> \-d code_verifier=<pkce-verifier>A confidential client also authenticates with its
client_secret. -
Call the API with the access token — see Call the API.
Public clients must use PKCE. The implicit flow is still accepted for older clients; do not use it for new work.
Start sign-in with a specific provider Since 1.10
Section titled “Start sign-in with a specific provider Since 1.10”If the tenant offers external sign-in (for example a national identity provider or
Microsoft Entra ID), add idp_hint=<provider name> to the authorization request to
skip the sign-in page and go straight to that provider. Use the provider’s unique
name, not its display label; ask the tenant administrator for it. An unknown or
inactive name is ignored and the normal sign-in page is shown.
When a domain offers exactly one external provider and nothing else, the sign-in page is skipped for every client by default. Do not rely on the sign-in page being shown (for example, to display its Cancel link) on such a domain.
When the user cancels Since 1.4
Section titled “When the user cancels Since 1.4”If the user selects Cancel on the sign-in page, or leaves it idle for 10 minutes,
your redirect URI receives error=access_denied with the state you sent. Treat it
as “the user declined”, not as a failure — for example, return to your home page.
Refresh tokens
Section titled “Refresh tokens”You get a refresh token when you request the offline_access scope, or when your
client is a public web client. Refresh before the access token expires:
curl -s -X POST https://<authority-host>/token \ -d grant_type=refresh_token \ -d refresh_token=<refresh-token> \ -d client_id=<client-id>- A refresh token lives 14 days, and can be renewed for at most one year in total.
- Refresh tokens rotate: a response may carry a new refresh token. Always store the one you received last; an old one may stop working.
- A public web client’s rotated refresh token keeps the remaining lifetime of the one it replaced, so a browser session cannot be extended forever.
Designing a client that keeps sessions alive across expiry and revocation is covered in Token lifecycle.
Server-to-server: client credentials
Section titled “Server-to-server: client credentials”A confidential client can get a token that acts as the client itself, with no user:
curl -s -X POST https://<authority-host>/token \ -u "<client-id>:<client-secret>" \ -d grant_type=client_credentialsSend the client credentials the way your client is registered for — HTTP Basic as
above, or client_id and client_secret as form fields. The token lives 10 minutes
unless your client was registered with another lifetime.
It carries no session. Request a new one when it expires.
What the token can reach: almost nothing. It identifies the client, not a user, so the gateway passes no user id on, and the platform resolves the caller to a profile with no permissions. The request is authenticated, and then nearly every read comes back refused or empty. On the real-time socket it connects, but subscribing to notifications is refused, because that needs a user. For your own server acting as itself, use an API token owned by a dedicated application user instead. Choosing a credential explains why.
Trusted scripts: the password grant
Section titled “Trusted scripts: the password grant”A trusted first-party client may exchange a user’s username and password directly:
curl -s -X POST https://<authority-host>/token \ -d grant_type=password \ -d username=<username> \ -d password=<password> \ -d scope="openid email profile offline_access" \ -d client_id=<client-id> \ -d client_secret=<client-secret>The response carries access_token, expires_in, token_type: Bearer, scope and,
when allowed, refresh_token.
| Answer | Meaning |
|---|---|
400 invalid_grant, “invalid credentials provided” | Wrong username or password. Repeated failures lock the account for an increasing time. |
400 invalid_grant, “account is locked” | The account is locked. Wait, or ask an administrator. |
400 invalid_scope | You asked for a scope the client is not allowed. |
Use this grant only where the script can safely hold a password. It bypasses second factors and external sign-in, so prefer the authorization code flow anywhere a person is present.
Call the API
Section titled “Call the API”Send the access token on every request to the tenant’s host:
curl -s https://acme.example.com/api/v2/entities/<entity>/entries/count \ -H "Authorization: Bearer <access-token>"- A
401withAUTHENTICATION_ERRORmeans the token is missing, expired or no longer active: refresh it, or sign the user in again. - For live updates over a socket, use the same access token; see Real-time.
- An
x-app-tokenheader, if present, is used instead of the bearer token.
Token lifetimes
Section titled “Token lifetimes”| Token | Lifetime |
|---|---|
| Access token | 1 hour, unless your client was registered with another lifetime |
| Client-credentials token | 10 minutes, unless your client was registered with another lifetime |
| Authorization code | 10 minutes |
| ID token | 1 hour |
| Refresh token | 14 days (rotated public-client tokens keep the remaining lifetime) |
| Grant and sign-in session | 14 days |
| Anonymous token | 10 minutes |
Scopes and claims
Section titled “Scopes and claims”| Scope | Claims released |
|---|---|
openid | sub |
email | email, email_verified |
profile | preferred_username |
offline_access | A refresh token |
A user’s custom claims, when the tenant defines them, are released as well. sub is
the user’s id in the tenant.
Anonymous visitors Since 1.10
Section titled “Anonymous visitors Since 1.10”A browser page that shows public content to visitors who are not signed in can get an anonymous token without any credential:
curl -s -X POST https://acme.example.com/api/identity/v1/anonymous/token{ "access_token": "<token>", "token_type": "Bearer", "expires_in": 600 }The token carries only the anonymous scope, so it reaches only what the tenant
opens to visitors. Never put a client secret in browser code: earlier integrations
that fetched an anonymous token with a system client’s secret must switch to this
endpoint, because that system client may not exist.
The tenant configuration shown in Find your tenant’s OpenID provider is also public, so a browser app can start without any deployment-specific settings.
Validate a token in your own service
Section titled “Validate a token in your own service”If you build a service that receives the platform’s access tokens, do not decode them yourself. Ask the provider: call the introspection endpoint from the discovery document with your client’s credentials:
curl -s -X POST https://<authority-host>/token/introspection \ -u "<client-id>:<client-secret>" \ -d token=<access-token>(Use form fields instead of HTTP Basic if your client is registered that way.) Accept
the token only when the answer has "active": true, and use its sub as the
user id. Check exp and client_id as your service requires.
Sign out and revoke
Section titled “Sign out and revoke”- Sign out: send the user to the provider’s end-session endpoint (from discovery)
with your registered
post_logout_redirect_uri. If the user signed in through an external provider that supports it, they are signed out there too. - Revoke a token: call the revocation endpoint (from discovery) with the token and your client credentials.
- Back-channel logout
Since 1.6: if your client is registered with a back-channel logout URI, the provider notifies it when the session ends.
Act on behalf of another user
Section titled “Act on behalf of another user”A person can act for a colleague during an authorized period — this is
delegation, set up by an administrator in Delegation.
To use an active delegation on a call, add its id in the X-Delegation-Id header.
The action is recorded as done for the colleague and by the person, so history stays
correct. Outside the delegation’s period the request is refused with
403 DELEGATION_EXPIRED. Delegation is for people covering for each other, not for
machine integrations.
API tokens
Section titled “API tokens”For a script or service that cannot run an OAuth flow, an API token sent in the
x-app-token header is simpler. It acts as an application user that a tenant
administrator creates — see
Create an API token for an integration — and
you use it as described in Use an API token.
Good to know
Section titled “Good to know”- Second factors and external providers are handled by the hosted sign-in page.
Depending on the tenant, users may be asked for an authenticator-app code, a code by
SMS, email or
Since 1.10WhatsApp, or a passkey. Use the authorization code flow and let the page present what the tenant requires, rather than building your own sign-in. - A tenant under maintenance
Since 1.10answers503 TENANT_IN_MAINTENANCEwithRetry-Afteron sign-in, token and refresh calls — for example while it is restored from a backup. Wait and retry; do not sign the user out. See Calling the HTTP API. - Tokens and the tenant. An access token from the authorization code or refresh flow is bound to the tenant’s sign-in host, so it cannot be replayed against another tenant.
Platform 1.10.0 · Backend 1.11.0-alpha.11 · Frontend 1.11.0-alpha.6 · Mobile 1.10.2 · Chart 1.11.8 · Gateway 2.6.11 · MCP 0.2.0 · Grafana DS 1.2.0Docs build 2026-11-27