EDIT: The breaking change happens between Grafana Version 10.1.10 and somewhere between 10.2.0 and 10.2.8
I also openend an issue on Github after creating this thread: Authentication/Login: Login Url Request with JWT Token does not set grafana_session cookies · Issue #90200 · grafana/grafana · GitHub
Just tested it on my docker environment.
I am running Grafana Version 11.1, before updating I was running Grafana 10. My application uses Grafana iframes to display charts. The login flow is the following:
- User logs into my web application
- Backend gives user a JWT
- Frontend automatically signs into Grafana with the JWT per URL request({grafana_url}/login/). An header is set(“X-JWT-Assertion”).
- User is now also logged into grafana, charts are viewable
-
What happened?
After updating to Grafana 11 from version 10 the grafana login response no longer contains the “Set-Cookie” headers for “grafana_session” and “grafana_session_expiry”, so the users stays signed out. Even though the login request itself was successful. New users do also get created by logging in per URL and jwt token, so grafana accepts it. The only difference I saw between version 10 and 11 are the missing Set-Cookie headers. -
Can you copy/paste the configuration(s) that you are having problems with?
[paths]
provisioning = /etc/grafana/provisioning
[server]
enable_gzip = true
serve_from_sub_path = true
protocol = http
http_port = 9000
domain = mydomain
root_url = %(protocol)s://%(domain)s:%(http_port)s/grafana/
[rendering]
callback_url = http://grafana:9000/
[security]
allow_embedding = true
[users]
allow_sign_up = false
auto_assign_org = true
auto_assign_org_role = Editor
default_theme = light
[log]
filters = rendering:debug
[auth]
disable_login_form = false
[auth.anonymous]
enabled = false
org_role = Viewer
org_name = Main Org.
[auth.proxy]
enabled = true
enable_login_token = true
[auth.jwt]
enabled = true
header_name = X-JWT-Assertion
username_claim = sub
role_attribute_path = role
key_file = /key_set/rsa_pub.pem
auto_sign_up = true