Failed to look up user based on cookie issue

  • What Grafana version and what operating system are you using?
    7.5.5-1 (Amazon Linux 2)

  • What are you trying to achieve?
    We are setting up HA cluster for Grafana

  • How are you trying to achieve it?
    We have Load Balancer in place and behind two grafana instances running with Mysql replication as master-master. We have configured grafana to restore dashboards, user data, session in Mysql backend database.

  • What happened?
    When we are logging in immediately we are logging out with an error ‘Unauthorized’ in browser whereas in grafana.log we are getting an error , "lvl=eror msg=“Failed to look up user based on cookie” logger=context error=“user token not found”

  • What did you expect to happen?
    We should not logged.

  • Can you copy/paste the configuration(s) that you are having problems with?
    /etc/grafana/grafana.ini

[paths]

[server]
protocol = http

root_url = http://localhost:3000

[database]
type = mysql
host = 127.0.0.1:3306
name = XXXXXXX
user = XXXXXX
password = xxxxxx

log_queries = true
[session]
provider = mysql
provider_config = XXXXX:XXXXXXXXX@tcp(127.0.0.1:3306)/XXXXX

[dataproxy]

[analytics]

[security]

[snapshots]

[users]

login_hint = Enter LDAP User ID

[auth]

[auth.anonymous]

[auth.google]

[auth.generic_oauth]

[auth.grafana_com]

[auth.basic]

[auth.ldap]
enabled = true
config_file = /etc/grafana/ldap.toml
allow_sign_up = true
[smtp]
enabled = true

host = localhost:25

from_address = admin@grafana.localhost
from_name = Grafana
ehlo_identity = dashboard.example.com
[emails]

[log]

level = error

[log.console]

[log.file]

[log.syslog]

[alerting]

[metrics]

[metrics.graphite]

[tracing.jaeger]

[grafana_com]
;url = https://grafana.com
[external_image_storage]

[external_image_storage.s3]

[external_image_storage.webdav]

[external_image_storage.azure_blob]

[external_image_storage.local]
[panels]
disable_sanitize_html = true


/etc/grafana/ldap.toml

[log]
filters = “ldap:debug”
[[servers]]
host = “ldap.XXXXXXXX.com
port = XXX
use_ssl = true
start_tls = false
ssl_skip_verify = false
root_ca_cert = “/etc/cert/XXXXXXXX”
bind_dn = “CN=XXXXXXXX,OU=Service Accounts,OU=XXXXX,OU=XXXXXX,OU=Servers and Services,DC=XXXXXX,DC=XXXXXX”
bind_password = ‘XXXXXXXX’
search_filter = “(sAMAccountName=%s)”
search_base_dns = [“DC=XXXXXXX,DC=com”]
[servers.attributes]
name = “givenName”
surname = “sn”
username = “sAMAccountName”
member_of = “memberOf”
email = “email”
[[servers.group_mappings]]
group_dn = “CN=XXXXXXX,OU=XXXXXXX,OU=XXXXXX,DC=XXXXXXX,DC=com”
org_role = “Admin”
[[servers.group_mappings]]
group_dn = “CN=XXXXXXX,OU=XXXXXXXX,OU=XXXXXXXX,DC=XXXXXXX,DC=com”
org_role = “Editor”
[[servers.group_mappings]]
group_dn = “CN=XXXXXX,OU=XXXXXXX,OU=XXXXX,OU=XXXXXX,DC=XXXXXX,DC=com”
org_role = “Viewer”

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

After login (with Ldap user ) we get an error “unauthorised” and logged out. In grafana error logs getting following error
lvl=eror msg=“Failed to look up user based on cookie” logger=context error=“user token not found”

  • Did you follow any online instructions? If so, what is the URL?
    Yes we tried all possible solution posted on different grafana community and other links but still having the same issue.

Hello All Community members,

Kindly help to resolve above issue.

Thanks in Advance.

This topic was automatically closed after 365 days. New replies are no longer allowed.