#12808·zitadel

[Bug]: service user grants ignore the instance OIDC token lifetime settings

Author: JoaoGabrielViannaCreated Sep 23, 2026Updated Sep 30, 2026

Preflight Checklist

  • I could not find a solution in the documentation, the existing issues or discussions
  • I have joined the ZITADEL chat

Environment

Self-hosted

Version

main (reproduced on a build from 1874e5850)

Database

PostgreSQL

Database Version

18

Describe the problem caused by this bug

Token lifetimes configured in the instance OIDC settings are ignored for service users. Both grants that authenticate a service user build a clientCredentialsClient, which takes its ID token lifetime from the server-wide OIDC.DefaultIdTokenLifetime configuration value rather than from the instance's idTokenLifetime setting.

Regular OIDC clients do not have this problem: client.Settings is loaded from the instance OIDC settings and only falls back to the server default when no settings exist (internal/api/oidc/client.go).

This means an administrator who changes the ID token lifetime in the Console sees it applied to applications, but not to service users, with no indication that the setting does not apply there.

To reproduce

  1. Set the instance ID token lifetime to a value different from the server default, for example 24h:
PUT /admin/v1/settings/oidc
{"accessTokenLifetime":"43200s","idTokenLifetime":"86400s",
 "refreshTokenIdleExpiration":"2592000s","refreshTokenExpiration":"7776000s"}
  1. Authenticate a service user with client_credentials (or with the JWT profile grant) requesting the openid scope.
  2. Decode the returned id_token and compare exp - iat.

Observed: 43200s (12h), the server default OIDC.DefaultIdTokenLifetime. Expected: 86400s (24h), the configured instance setting.

Expected behavior

Service user grants should honour the instance OIDC settings for token lifetimes, consistent with how regular OIDC clients resolve them, falling back to the server default only when no instance settings exist.

Additional Context

Found while working on #12779, which is a different bug in the same area: the JWT profile grant did not set the field at all, so its ID tokens were issued with exp == iat. That one is addressed in #12807 by aligning the JWT profile grant with the client credentials grant. This issue is about the value both of them use, and is deliberately kept separate because fixing it changes behaviour for existing deployments.