Issue when trying to combine keycloak and grafana

Hi,
i have an issue when i try to integrate keycloak with grafana. When i click on the “Sign in with keycloak”, i am redirect to the grafana login page, without pass by keycloak.
There is my grafana.ini file :

[analytics]
check_for_updates = true
[auth.generic_oauth]
allow_signup = true
api_url = https://id.domain.io/auth/realms/master/protocol/openid-connect/userinfo
auth_url = https//id.domain.io/auth/realms/master/protocol/openid-connect/auth
client_id = grafana
client_secret = $__file{/etc/secrets/auth_generic_oauth/client_secret}
enabled = true
name = Keycloak
role_attribute_path = contains(groups[*], 'grafana-admin') && 'Admin' || contains(groups[*], 'grafana-editor') && 'Editor' || 'Viewer'
scopes = openid profile email
token_url = https://id.domain.io/auth/realms/master/protocol/openid-connect/token
[grafana_net]
url = https://grafana.net
[log]
level = debug
mode = console
[paths]
data = /var/lib/grafana/
logs = /var/log/grafana
plugins = /var/lib/grafana/plugins
provisioning = /etc/grafana/provisioning
[server]
domain = grafana.domain.io
root_url = https://grafana.domain.io

There is the only lines in the logs when i trying :

logger=context traceID=00000000000000000000000000000000 userId=0 orgId=0 uname= t=2023-02-16T13:33:59.386318115Z level=info msg="Request Completed" method=GET path=/login/generic_oauth status=302 remote_addr=82.64.61.128 time_ms=1 duration=1.053225ms size=342 referer=https://grafana.domain.io/login traceID=00000000000000000000000000000000
logger=context traceID=00000000000000000000000000000000 userId=0 orgId=0 uname= t=2023-02-16T13:33:59.424572204Z level=info msg="Request Completed" method=GET path=/login/https/id.domain.io/auth/realms/master/protocol/openid-connect/auth status=302 remote_addr=82.64.61.128 time_ms=1 duration=1.376213ms size=29 referer=https://grafana.domain.io/login traceID=00000000000000000000000000000000

the only things that i see is th path used in 2nd log’s line : /login/https/id.domain.io/auth/realms/master/protocol/openid-connect/auth
thx

My guess, you are missing valid URL:

1 Like