diff --git a/docs/sources/setup-grafana/configure-security/configure-authentication/generic-oauth/index.md b/docs/sources/setup-grafana/configure-security/configure-authentication/generic-oauth/index.md index 6ca73040d02..35e881c3a15 100644 --- a/docs/sources/setup-grafana/configure-security/configure-authentication/generic-oauth/index.md +++ b/docs/sources/setup-grafana/configure-security/configure-authentication/generic-oauth/index.md @@ -516,3 +516,42 @@ To set up generic OAuth2 authentication with OneLogin, follow these steps: team_ids = allowed_organizations = ``` + +### Set up OAuth2 with Dex + +To set up generic OAuth2 authentication with [Dex IdP](https://dexidp.io/), follow these +steps: + +1. Add Grafana as a client in the Dex config YAML file: + + ```yaml + staticClients: + - id: + name: Grafana + secret: + redirectURIs: + - 'https:///login/generic_oauth' + ``` + + {{% admonition type="note" %}} + Unlike many other OAuth2 providers, Dex doesn't provide ``. + Instead, a secret can be generated with for example `openssl rand -hex 20`. + {{% /admonition %}} + +2. Update the `[auth.generic_oauth]` section of the Grafana configuration: + + ```bash + [auth.generic_oauth] + name = Dex + enabled = true + client_id = + client_secret = + scopes = openid email profile groups offline_access + auth_url = https:///auth + token_url = https:///token + api_url = https:///userinfo + ``` + + `` corresponds to the `issuer: ` configuration in Dex (e.g. the Dex + domain possibly including a path such as e.g. `/dex`). The `offline_access` scope is + needed when using [refresh tokens]({{< relref "#configure-a-refresh-token" >}}).