Skip to main content

Token Management

ChainIT uses JWTs for access and ID tokens, and an opaque refresh token that is not a JWT.

How tokens are signed
  • Access token: JWT signed with RS256. Verify using your organization’s JWKS URL (the path includes your organization UUID).

  • ID token: JWT signed with RS256 using the same key as the access token. Verify against the same JWKS URL — do not use your client secret.

  • Refresh token: Opaque string (not a JWT); do not parse or verify like a JWT.


OAuth endpoints

OAuth token exchange uses your API host (from DOCUSAURUS_API_BASE_URL at build time — the same host the Developer Portal shows under Application → Advanced → Token endpoint). It is usually not the same as DOCUSAURUS_BASE_URL (the web portal / docs origin), unless you deliberately colocate them.

POST https://api.chainit.online/oauth/token

The full URL is also shown in the Developer Portal under Application → Advanced → Token Endpoint. The complete set of endpoints — /oauth/authorize, /oauth/token, /oauth/userinfo, /oauth/revoke, /oauth/logout, and /oauth/<orgId>/.well-known/jwks.json — is discoverable at /oauth/.well-known/openid-configuration. See OAuth server metadata.

EndpointMethodPurpose
/oauth/.well-known/openid-configurationGETServer metadata / discovery (RFC 8414). See Server metadata.
/oauth/authorizeGETAuthorization Code endpoint (RFC 6749 §4.1.1).
/oauth/tokenPOSTToken exchange + refresh (RFC 6749 §4.1.3 / §6).
/oauth/userinfoGETOIDC UserInfo. See User Info API.
/oauth/revokePOSTRevoke an access or refresh token (RFC 7009). See Token revocation.
/oauth/logoutPOSTRP-Initiated Logout (OIDC). See Logout.
/oauth/{orgId}/.well-known/jwks.jsonGETOrg-scoped JWKS for access-token verification. See Token validation.

Token types

Token TypeDescriptionFormatSigning / verification
Access TokenUsed to access protected APIsJWTRS256 + org-scoped JWKS
ID TokenOIDC identity claims (requires openid scope)JWTRS256 + the same org-scoped JWKS
Refresh TokenUsed to obtain new tokens without re-loginOpaqueNot a JWT — treat as a secret handle
Session TokenHosted-auth flow session — internal, round-tripped only with ChainIT APIsJWTHS256 (internal); consumers never verify this directly
Refresh tokens

OAuth applications rotate refresh tokens by default. You can disable this per app with rotateRefreshTokens: false when a client cannot reliably persist the new refresh token returned by every refresh call. See Refresh tokens for the full refresh-token endpoint reference and rotation behaviour.


Token structure

Access token claims

interface AuthClaims {
aud: string[]; // Audience
azp: string; // Authorized party (clientId)
exp: number; // Expiration timestamp
iat: number; // Issued at timestamp
iss: string; // Issuer
scope: string; // Granted scopes
sub: string; // Subject (userId)
permissions: string[]; // Assigned permissions
}

Signing algorithms

AlgorithmUsageKey type
RS256OAuth access tokens and ID tokensAsymmetric (verify via the org JWKS)
HS256Internal hosted-auth session tokens (round-tripped to ChainIT only)Symmetric (internal secret) — not exposed to consumers
One key, two tokens

ChainIT signs both access and ID tokens with the same RS256 private key, so a single JWKS lookup verifies both. You never need your clientSecret to validate ID tokens. The HS256-signed hosted-auth session token is an internal artifact you pass back to ChainIT — it is not for third-party verification.


Token expiration options

OptionSecondsDescriptionUse Case
ONE_HOUR3600Short-lived tokensHigh-security applications
TWELVE_HOURS43200Medium-lived tokensStandard web applications
ONE_DAY86400Daily tokens (default)Most applications
SEVEN_DAYS604800Long-lived tokensMobile/offline applications

Configured per application via tokenExpireTime.

Token expiration

Shorter token lifetimes improve security but require more frequent refresh. Balance security with user experience based on your application's needs.


Token validation

Token validation

See Token validation for:

  • Org-scoped JWKS URL for access and ID tokens

  • RS256 verification (same JWKS for both token types)

  • Why refresh tokens are not JWTs

  • Token introspection endpoint

Client secret rotation

When you rotate clientSecret in the Developer Portal, you can set an optional grace period so previous and new secrets may both work for a limited time while you update deployments. See Grace period.

What to validate

ClaimDescriptionHow
SignatureToken was signed by ChainITAccess and ID: verify RS256 with the org-scoped JWKS.
expToken has not expiredCheck exp > now
issToken was issued by expected issuerMatch the iss claim for your environment
audToken is intended for your serviceCheck audience claim
scopeToken has required scopesCheck scopes contain needed permission
orgIdToken belongs to your organizationValidate orgId claim where present

Next steps

Next steps