Use OIDC Client Credentials Grant
- Deciders: Julian Bäume, David Bauer
- Date: 2025-08-05
Status
Superseded by ADR 0011
Context
Initially a custom implementation was used to get impersonation tokens for users. We used our own Switchboard service implementation to get a JWT token for any user, which then was used to talk to the App Suite API. Unfortunately it's only possible to configure exactly one oauth provider in App Suite and we eventually conflicted with other applications that want to use App Suite API. These other applications sometimes are even external ones, using Authorization Code Flow, for instance. The OpenID Connect Client Credentials Grant is a standard way to get an access token for a user without requiring user interaction. As Teams is a service usually running in the same domain as App Suite, for users it would feel strange to have to authorize the usage of Teams in App Suite separately.
For that reason, we want to switch to the OpenID Connect Client Credentials Grant preferably using Keycloak. In order to "impersonate" a user, the service needs to explicitly request the App Suite login claim dynamically, which is not possible with the standard Keycloak OIDC mappers. Therefore we need to implement a custom mapper that extracts the user identifier from the request and returns it as a claim in the token. This is a little drawback, as it requires a Keycloak customization, but this allows us to have a centralized IDP to do all authentication and authorization for all applications in the App Suite ecosystem.
Decision
We will implement a custom Keycloak mapper to extract the user identifier from the request and return it as a claim in the token. This will allow us to use the OpenID Connect Client Credentials Grant to get impersonation tokens for users without requiring user interaction.
Consequences
By implementing those changes, we will be able to configure a centralized IDP for all applications in the App Suite ecosystem. Everything is using standard protocols, which are well documented and supported. This allows the service to communicate with the App Suite API in a secure way in the name of the user, without requiring user interaction.

