The OAuth access token is stored as a global package-level variable, which means all datasource instances share the same token. This causes authentication issues when multiple Trino datasources are configured with different OAuth client_id / client_secret pairs or different authentication methods.
As a result:
- User A configures a Trino datasource with `client1 / secret1 → obtains tokenA
- User B configures another Trino datasource with
client2 / secret2 → unexpectedly reuses tokenA instead of generating its own
- When any token expires, datasource A may begin using datasource B’s token, or vice-versa (after refresh the token)
The root cause is this global variable:
https://github.com/trinodb/grafana-trino/blob/7b190bc0f359ceb3d432790a6dfed110aa324ce8/pkg/trino/client/client.go#L15C1-L18C2
The OAuth access token is stored as a global package-level variable, which means all datasource instances share the same token. This causes authentication issues when multiple Trino datasources are configured with different OAuth client_id / client_secret pairs or different authentication methods.
As a result:
client2 / secret2→ unexpectedly reuses tokenA instead of generating its ownThe root cause is this global variable:
https://github.com/trinodb/grafana-trino/blob/7b190bc0f359ceb3d432790a6dfed110aa324ce8/pkg/trino/client/client.go#L15C1-L18C2