# Grafana failing to properly parse OAuth Client secrets provided through standard Kubernetes Secret-to-environment variable mapping

**URL:** <https://community.grafana.com/t/grafana-failing-to-properly-parse-oauth-client-secrets-provided-through-standard-kubernetes-secret-to-environment-variable-mapping/161093>\
**Category:** Authentication\
**Created:** [January 16, 2026, 7:37pm UTC](https://community.grafana.com/t/grafana-failing-to-properly-parse-oauth-client-secrets-provided-through-standard-kubernetes-secret-to-environment-variable-mapping/161093 "2026-01-16T19:37:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nataliecita](https://avatars.discourse-cdn.com/v4/letter/n/ac8455/32.png) [@nataliecita](https://community.grafana.com/u/nataliecita)\
**Post date:** [January 16, 2026, 7:37pm UTC](https://community.grafana.com/t/grafana-failing-to-properly-parse-oauth-client-secrets-provided-through-standard-kubernetes-secret-to-environment-variable-mapping/161093/1 "2026-01-16T19:37:45Z")

</div>

- What Grafana version and what operating system are you using?

- **What** are you trying to achieve?  
Trying to authenticate with SSO

- **How** are you trying to achieve it?

- What happened?

- What did you **expect** to happen?

- Can you copy/paste the configuration(s) that you are having problems with?

- Did you receive any errors in the Grafana UI or in related logs? If so, please tell us **exactly** what they were.

- 

```auto
logger=authn.service t=2026-01-16T17:31:33.954671787Z level=error msg="Failed to authenticate request" client=auth.client.generic_oauth error="[auth.oauth.token.exchange] failed to exchange code to token: oauth2: \"invalid_client\" \"The client secret supplied for a confidential client is invalid.\"

```

- Did you follow any online instructions? If so, what is the URL?  
N/A

- Grafana should successfully read and parse the OAuth client secret from the environment variable and complete authentication.

- We even tried entering the secret manually in the Grafana UI. That did not work either.

- We had to hardcode the SSO client secret in Grafana ENVs and commit our code to repository
