Session token claims
The user cookie XYZ signs, whether at login (redirect), on cookie renewal or in the auth module, merges the claims returned by jwtClaims():
| Variable | Claim | Default |
|---|---|---|
JWT_TYPE | typ | session |
JWT_ISSUER | iss | xyz |
JWT_AUDIENCE | aud | xyz |
JWT_AUDIENCE is split on commas, so aud is always an array, eg. JWT_AUDIENCE=xyz,other-service gives ["xyz", "other-service"].
The claims let another service authenticate users through XYZ by verifying the token type, issuer and audience. A service that verifies against fixed names needs JWT_ISSUER and JWT_AUDIENCE set to match. XYZ itself does not check the claims when it verifies a token.
Tokens from /api/user/token and API keys from /api/user/key do not carry these claims; an API key is marked by its api claim instead. Signing them with the claims is tracked in #3166.
The defaults are applied in processEnv.js with ??=, unlike most XYZ defaults which use ||=. An empty value, as declared by a varlock schema without a value, is kept rather than replaced, and gives an empty claim. The jwtClaims JSDoc still says the variables must be configured for the claims to be included; the defaults make that obsolete (#3155).
Changing these values invalidates tokens for any service which verifies the previous claims.