Fix Grafana Authentik SSO (500 + missing email claim) + RP landing test #54

Merged
dank merged 5 commits from fix/grafana-authentik-sso into main 2026-10-20 21:04:02 -07:00
2 changed files with 8 additions and 7 deletions
Showing only changes of commit 6f442a14a3 - Show all commits

No files matched your search

@@ -47,11 +47,12 @@ Environment=GF_AUTH_GENERIC_OAUTH_CLIENT_SECRET=${GRAFANA_OAUTH_CLIENT_SECRET}
# client_id query parameter — /application/o/<slug>/authorize/ does not exist. # client_id query parameter — /application/o/<slug>/authorize/ does not exist.
Environment=GF_AUTH_GENERIC_OAUTH_AUTH_URL=https://auth.franksdank.cloud/application/o/authorize/ Environment=GF_AUTH_GENERIC_OAUTH_AUTH_URL=https://auth.franksdank.cloud/application/o/authorize/
Environment=GF_AUTH_GENERIC_OAUTH_TOKEN_URL=https://auth.franksdank.cloud/application/o/token/ Environment=GF_AUTH_GENERIC_OAUTH_TOKEN_URL=https://auth.franksdank.cloud/application/o/token/
# Read claims from the signed ID token. Grafana v13 always appends /emails to # Standard OIDC userinfo. Grafana v13 fetches <api_url>/emails for the address
# API_URL and GETs it as a userinfo endpoint (authentik has no such path and # ONLY when the token carries no `email` claim (authentik has no /emails path and
# 404s it, failing the login). USE_ID_TOKEN makes Grafana take sub/email/name # 404s it, failing the login) — so the claim must actually be there: the fix is
# from the id_token, which authentik fills from the openid/email/profile scopes. # the grafana-email-scope mapping (see scripts/authentik-grafana-sso-fix.sh),
Environment=GF_AUTH_GENERIC_OAUTH_USE_ID_TOKEN=true # not a Grafana flag. Do NOT append ?api=1 to this URL: Grafana then GETs
# <...>/userinfo/?api=1/emails, a 403.
Environment=GF_AUTH_GENERIC_OAUTH_API_URL=https://auth.franksdank.cloud/application/o/userinfo/ Environment=GF_AUTH_GENERIC_OAUTH_API_URL=https://auth.franksdank.cloud/application/o/userinfo/
# authentik's scopes are openid/email/profile. `user:email` (a GitLab-ism) is # authentik's scopes are openid/email/profile. `user:email` (a GitLab-ism) is
# not a known scope here; requesting it makes the authorize view crash. # not a known scope here; requesting it makes the authorize view crash.
+2 -2
View File
@@ -29,8 +29,8 @@
# facts and the symptom returns verbatim. Re-run this after any such rebuild. # facts and the symptom returns verbatim. Re-run this after any such rebuild.
# Every step is idempotent. # Every step is idempotent.
# #
# Grafana's own half — SCOPES="openid email profile", USE_ID_TOKEN=true, no # Grafana's own half — SCOPES="openid email profile", a standard userinfo API_URL
# `?api=1` on the API URL, ALLOW_SIGN_UP=true — lives in # with no `?api=1`, and ALLOW_SIGN_UP=true — lives in
# dankclaw/observability/quadlet/grafana.container and deploys normally. # dankclaw/observability/quadlet/grafana.container and deploys normally.
# #
# Usage: authentik-grafana-sso-fix.sh (override host: AUTHENTIK_HOST=…) # Usage: authentik-grafana-sso-fix.sh (override host: AUTHENTIK_HOST=…)