Client access tokens are used to authorize backend API calls to Mosaic services. They are retrieved by calling the /oidc/token endpoint using a client credentials flow (see Get client access tokens), and passed in the Authorization header of API calls to authorize them. This describes the structure and semantics of the client access tokens returned by Mosaic.
The access token is a JWT (Json Web Token) signed by Mosaic. It contains standard JWT claims, and describes the access context, such as the client, application, and tenant for which it was generated, and the resource and scopes that were granted. A client access token does not include a user's permissions or roles. ts_roles and ts_permissions authorize calls to Mosaic APIs and are separate from application permissions on a user access token. For how aud and scope are calculated, see How authorization works.
| Claim | Description | Type |
|---|---|---|
| sub | Subject of the token (client_id) | String |
| iss | Issuer of the token, which should match the issuer returned from the /oidc/jwks endpoint. | String |
| iat | Time the token was issued. | Number |
| exp | Expiration time, in epoch time format. The token will not be accepted on or after this time. | Number |
| aud | Audience, which is the intended recipient of the token. If the requested resource is assigned to the client, this is that resource URI. If no resource is requested, the default is userid-api. | String |
| scope | Requested scopes that are assigned to the client, as a space-delimited string. Includes global scopes assigned to the client, and resource-specific scopes assigned to the client when they belong to the requested resource. Requested scopes that are not assigned to the client, and scopes that belong to another resource, are omitted. If no resource is requested, only global scopes are included. | String |
| role | Contains the Admin role for an admin access token (which are generated using credentials of a Management Application). | Array |
| client_id | Identifier of the client that requested the access. | String |
| app_name | Friendly name of the application that requested the access. | String |
| app_id | Identifier of the application that requested the access. | String |
| tid | Identifier of the tenant that requested the access. | String |
| ts_roles | Lists roles assigned to the client. If no role is explicitly assigned, a first-party client inherits the application's Admin role. | Array |
| ts_permissions | Mosaic API permissions granted to the client through assigned client roles. These are distinct from application permissions on a user access token. Any changes to client roles take up to 5 minutes to propagate, meaning that updated permissions will appear in new client access tokens generated no sooner than in 5 minutes after the change was made. | Array |
| cnf | Contains X.509 certificate thumbprint (SHA-256) as a confirmation of token being bound to a specific certificate (only if token binding is enabled for mTLS or private key JWT authentication). Includes x5t#S256 key and its value. | Object |
Here's an example of a decoded client access token:
{
"tid": "6oi3tjkijshdfgekwjfwey9",
"app_name": "Acme",
"app_id": "zl2trg3sanjsd63qs7se",
"roles": [],
"jti": "ABCSrjsReaYKk-FSHHZU",
"sub": "u6jkjhsdf87efbwv57u",
"iat": 1675590719,
"exp": 1675594319,
"scope": "openid offline_access",
"client_id": "pVEZaxjhbdshcudsLe",
"iss": "https://userid.security",
"aud": "userid-api",
"ts_roles": ["reader"],
"ts_permissions": ["users:read"]
}