-
What Grafana version and what operating system are you using? 11.0.0
-
What are you trying to achieve? Set up generic Oauth with EU Login provider
-
How are you trying to achieve it? Using the auth.generic_oauth settings
-
What happened? I keep getting the error: Failed to get token from provider on the UI
-
What did you expect to happen? The user is redirected and logged in to our grafana
-
Can you copy/paste the configuration(s) that you are having problems with?
[auth.basic]
enabled = true
; disable_login_form = true
[auth.generic_oauth]
enabled = true
; auto_login = true
name = EU Login
allow_sign_up = false
client_id = "sTKWJ***"
client_secret = "T0mP***"
scopes = openid profile
auth_url = ***/authorize
token_url = ***/token
api_url = ***/token/introspect
use_pkce = true
[security]
oauth_enabled = true
oauth_role_mapping = ({{ grafana_admin_role }} == user.role) ? 'Admin' : ({{ grafana_viewer_role }} == user.role) ? 'Viewer' : 'None'
- Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were. Yes, the error in the UI is: Failed to get token from provider
And the error in the logs are:
grafana-1 | logger=authn.service t=2024-06-19T12:02:38.407586216Z level=warn msg="Failed to authenticate request" client=auth.client.session error="user token not found"
grafana-1 | logger=context userId=0 orgId=0 uname= t=2024-06-19T12:02:38.407886395Z level=info msg="Request Completed" method=GET path=/login/generic_oauth status=302 remote_addr=172.18.0.1 time_ms=0 duration=907.841µs size=472 referer=http://localhost:3000/login handler=/login/:name status_source=server
grafana-1 | logger=authn.service t=2024-06-19T12:02:39.293060017Z level=warn msg="Failed to authenticate request" client=auth.client.session error="user token not found"
grafana-1 | logger=authn.service t=2024-06-19T12:02:39.460942605Z 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\" \"Client authentication failed: The client is not registered for the requested authentication method: 'client_secret_post'\""
- Did you follow any online instructions? If so, what is the URL? Tried a lot, using different methods of running the code, docker wsl, docker desktop, … Tried playing with the settings.