Login Page redirect to login page after successfull login

Login loop when using Chrome to access Grafana in an iframe. Doesn’t happen when using SSL cert.

I have this same issue on my docker container, local access, no proxy, not https.

I was running 7.1.5, updated to 7.2 andnow I get redirected back to the login page after successful login. This happens ONLY on Chrome - I tried it from Safari and Firefox, and it works correctly. I also tried it from a brand new chrome instance (no leftover cache/cookies/extensions) and it fails as well.

302 error in grafana.log:

t=2020-09-24T14:56:22+0000 lvl=info msg=“Successful Login” logger=http.server User=root@localhost
t=2020-09-24T14:56:22+0000 lvl=info msg=“Request Completed” logger=context userId=0 orgId=0 uname= method=GET path=/ status=302 remote_addr=192.168.25.68 time_ms=0 size=29 referer=http://192.168.25.195:3003/login

I was able to fix this by setting cookie_sametime and allow_imbedding back to the default values.

I had the exact same problem recently, with :

  • synology NAS (ds218+ running DSM 6.2.3)
  • docker image philhawthorne/docker-influxdb-grafana (with Grafana v7.2.0 (efe4941ee3))

Symptom : first login with root cannot succeed, I recieve a HTTP302 that redirects to the login page. Edge + FF + Chrome have this issue.

workaround :
In grafana.ini :
[server]
domain = nas-ds219plus (instead of “localhost”)
root_url = http://nas-ds219plus:3003 (instead of h t t p : / / localhost:3003) [1]
[security]
cookie_samesite = disabled (not sur this is relevant though)

then loading grafana with h t t p : / / nas-ds219plus:3003 [1] instead of using h t t p : / / 192.168.0.12:3003 [1]

[1] : sorry for the strange editing, new users can only insert 2 links in a post ^^)

Please use this

[security]
;    allow_embedding = true

I have this issue several weeks ago and make the security part as default, then the issue was gone.
I think not to change the default config if not necessary.

I have the same problem because set “cookie_samesite = none”

any rectification for this login loop?

I have tried all the recommendations in the thread and it still prevails… “logged In” followed by a reloading of the login page.

Using docker-compose, grafana:7.3.7-ubuntu

{REMIDAITED}
Not sure what changed… but on the third build of the image with same settings it logged in correctly… :man_shrugging:

I used to have this enabled. Outcommented now as I am not on HTTPS and it works:

set to true if you host Grafana behind HTTPS. default is false.

;cookie_secure = true

3 Likes

After doing the configurations just open grafana with https (even if you are not using ssl). You will logged in successfully. I have spend many days for the solution of this issue and finally found this solution. So if your subdomain is monitoring.abc.com , just open this as https://monitoring.abc.com and it will start working.

I had the same issue. The problem for me was I had set anonymous access org_name in the grafana.ini to the wrong name. Every time I logged in it redirected to the login page even though it said successful login.
You can check the organisation name in the grafana dashboard in the Admin Organization Page.

I was also using these grafana.ini settings and connecting over http

# enable anonymous access
enabled = true

# specify organization name that should be used for unauthenticated users
org_name = my_organization

# set to true if you host Grafana behind HTTPS. default is false.
cookie_secure = false

# set cookie SameSite attribute. defaults to `lax`. can be set to "lax", "strict", "none" and "disabled"
cookie_samesite = none
```

This works :+1:

hi im running this on version 11.1.0 currently i have cookies_samesite set = none and ;cookie_secure = true when i have it so its “cookie_secure = true” i get a Failed to determine the state of the SSO redirect. im using keycloak saml for auth