Skip to main content
When a person signs in to your app, Aiveth’s token endpoint returns an ID token and an access token, and a refresh token if you asked for one. This page explains each one, the claims they carry, and how to add claims of your own with a token template.

The tokens at a glance

The access token is not a JWT and cannot be decoded. It reads /oauth/userinfo and nothing else, so it can never be used against Aiveth’s own APIs.

ID token

Verify the ID token with the keys at the jwks_uri from the discovery document (https://accounts.aiveth.com/v1/auth/.well-known/jwks.json). Check:
  • the signature (RS256),
  • iss is https://accounts.aiveth.com (or your custom domain, when the person signed in there),
  • aud is your client ID,
  • exp is in the future,
  • nonce matches the one you sent.
The Node SDK does all of this except the nonce check:

Standard claims

Claims Aiveth adds when they apply

Claims from the token template, and from your sign-in check, are added too. See below.

Access token and userinfo

Send the access token to /oauth/userinfo as Authorization: Bearer <token> (or Authorization: DPoP <token> for a DPoP-bound token). The answer has sub and the same profile, role, group and template claims as the ID token, for the scopes the app asked for. An access token stops working when:
  • it reaches its 1-hour expiry,
  • the person’s Aiveth session ends (for a normal sign-in), or
  • the sign-in is ended: the person disconnects the app, an admin signs them out everywhere, they are suspended, or the app revokes it.
If you call it often, keep the answer for a short time.

Refresh tokens

Ask for the offline_access scope to get a refresh token. It keeps the person signed in to your app even after their Aiveth session ends.
  • Rotation. Every use returns a new refresh token, and the old one stops. Store the new one each time.
  • Reuse detection. If an old refresh token is presented again more than 30 seconds after it was swapped, Aiveth treats it as stolen and ends the whole sign-in. The person must sign in again. Within those 30 seconds it works once more, so a lost reply on a bad network doesn’t sign anyone out.
  • Narrower scope. You may pass scope to ask for less than the original grant, never more.
  • Lifetime. By default a refresh token ends after 30 days unused or 90 days at most. You can change both for each app in its panel under Staying signed in: 1 to 90 days unused, and 1 to 365 days at most. A change applies to sign-ins already running.
  • Ends early on a password change or reset, an admin’s sign-out of everyone, a suspension or removal, the person disconnecting the app, the app being turned off, or the app revoking it.
A refresh also returns a fresh ID token, and your sign-in check (if any) runs again first.

Ending a token

Your app can end its own refresh token or access token at /oauth/revoke (RFC 7009). The answer is always 200, whether or not there was anything to end. Revoking a refresh token ends the whole sign-in, and Aiveth sends a back-channel logout notice if the app registered an address for one.

Introspection

App access tokens are opaque, and Aiveth answers for them only at /oauth/userinfo. A 401 there means the token has ended. The /oauth/introspect endpoint (RFC 7662) answers for AI agent tokens only. Your MCP server can use it to learn the moment an agent is stopped. See Agent tokens. Machine tokens are JWTs. Verify them offline; see Machine-to-machine.

Add your own claims with a token template

A token template adds details from your organization and its people to every ID token and to the userinfo answer, whatever scope the app asked for. You have one template per organization.
The token template needs the Pro plan or above.
1

Open Developers

In the console, open Developers and find What sign-in tokens include.
2

Write the template

Under Template (JSON), write a JSON object whose values use placeholders:
3

Preview and save

Select Preview for me to see what it would add for you, then Save. Your Owners are emailed about every change.

Placeholders

You can use only details that may be shown:
  • user.id, user.email, user.first_name, user.last_name, user.public.*
  • org.id, org.slug, org.name, org.public.*
user.public.* and org.public.* read public custom fields. Private fields, and fields a person fills in themselves, can never go in a token.

How values render

  • A value that is exactly one placeholder becomes that value as it is. A number stays a number.
  • A placeholder inside other text becomes text.
  • A placeholder that finds nothing drops its key.

Limits

  • The template, and what it renders to, may be at most 3 KB.
  • Objects nest at most 3 levels deep.
  • You can’t use a name Aiveth sets itself, such as sub, iss, aud, exp, email, name, org_id, role, roles, permissions, groups, scope, consent, feature_flags or any other standard JWT or OpenID Connect claim. Aiveth’s own claims always win.

Claims from your sign-in check

If you set up a Sign-in check under Developers, your server can answer “allow” with extra details for the token. They follow the same rules as the template and go in that sign-in’s ID token only.