"401: Unauthorized" iframe CARD of Grafana not working

iframe of Grafana is not working. Read a few threads about allowing anonymous logins. But cant alter the config setting (in hassio) without errors.

iframe of Grafana works on local network but not www.

However. If you click on the Grafana tab on the main navigation (on the left), then click back to a page with your iframes, it works.

The solution is probably dead simple but a google search is pretty full of (recent) requests for solution, with little definitive answers.

Any ideas?

Opened all ports on HA hosting computer. Still nowt…

As per manual in grafana hassio addon (configuration window):


{
  "plugins": [
    "natel-discrete-panel",
    "mtanda-histogram-panel",
    "blackmirror1-singlestat-math-panel",
    "fetzerch-sunandmoon-datasource",
    "grafana-worldmap-panel"
  ],
  "env_vars": [
    {
      "name": "GF_AUTH_ANONYMOUS_ENABLED",
      "value": "true"
    },
    {
      "name": "GF_SECURITY_DATA_SOURCE_PROXY_WHITELIST",
      "value": "XXXXXXXXX.org:8086"
    },
    {
      "name": "GF_SECURITY_ALLOW_EMBEDDING",
      "value": "true"
    },
    {
      "name": "GF_AUTH_BASIC_ENABLED",
      "value": "true"
    }
  ],
  "log_level": "info",
  "ssl": true,
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem"
}

Nowt… Still getting “401 Unauthorized”

I just recently started having this same issue. I’ll try playing around with some variables and see if I can yield any results then report back.

1 Like

At least it’s consistently rubbish.
Once you navigate to grafana (main program) on the left navigation. Then back to a window with iframe. They display. For a while.

Heres my config so far!


{
  "plugins": [
    "grafana-worldmap-panel"
  ],
  "env_vars": [
    {
      "name": "GF_AUTH_ANONYMOUS_ENABLED",
      "value": "true"
    },
    {
      "name": "GF_SECURITY_ALLOW_EMBEDDING",
      "value": "true"
    },
    {
      "name": "GF_SECURITY_COOKIE_SAMESITE",
      "value": "none"
    },
    {
      "name": "GF_SECURITY_COOKIE_SECURE",
      "value": "true"
    },
    {
      "name": "GF_SECURITY_LOGIN_REMEMBER_DAYS",
      "value": "365"
    },
    {
      "name": "GF_AUTH_BASIC_ENABLED",
      "value": "true"
    }
  ],
  "log_level": "info",
  "ssl": true,
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem"
}

Hope some other people join the quest :grinning:

1 Like

Unfortunately no help, other than let you know that you are not alone. I got exactly the same problem.
running on: Hass.io, NUC, Docker, DuckDNS.

1 Like

Sounds like it may be a CORS issue, it may be worth checking the Grafana settings.

We’ve all checked the settings to the best of our knowledge (no doubt). I know I have…
thanks for the input. Will google it and see if I can find owt new with it :+1:

Same problem here. Unable to find a solution, but will keep you posted if I do…

2 Likes

Follow up the issue on github page. https://github.com/hassio-addons/addon-grafana/issues/55 Everyone has the same problem, no solution yet. The most logical comment comes from @jcwillox there. Could be an ingress session creation problem…

2 Likes

Never done a github issue, sounds fun!

1 Like

Just to report. I am having the same issue,
in lovelace I see 401, unauthorized
INfluxDB is working fine.
Grafana is working, it sees the data from homeassistant. First attempt of creating iframe is fine, nice graphs. after closing everything and trying it a while later, HA shows the 401 message.

Hope it will be solved with next update :slight_smile:

5 Likes

I’m also experiencing this, thought I had forgotten the damn password again :stuck_out_tongue:

2 Likes

I solved on my docker installation as github ticket suggest.
On docker server i installed sqlite3 package and then do the job

root@docker:/# apt install sqlite3
Reading package lists... Done
Building dependency tree
Reading state information... Done
[...] [....]
root@docker:/# sqlite3 /usr/share/hassio/addons/data/a0d7b954_grafana/grafana.db
SQLite version 3.27.2 2019-02-25 16:06:06
Enter ".help" for usage hints.
sqlite> select name from org;
TWProject
sqlite>

1 Like

Great that you solved it.
Do you suggest to ssl into hassio, login as root.
Type: ‘apt install sqlite3’
Then: ‘sqlite3 /usr/share/hassio/addons/data/a0d7b954_grafana/grafana.db’

I run Hass. IO as VM. Does this still apply?
I can test tonight,

[edit]
tried it just now. doesnt work on hassio i gues (or I dont understand it).

in my case i have hassio under a proxmox vm as docker
I did the sqlite3 procedure on vm not on hassio

@frenck
Just a quick question.
Do you recognize the issue we describe? or are we forgetting something obvious?

And just a big thanks to everything you are doing for this amazing project…
regards,

No you’re not forgetting about anything. It isn’t possible to do at this time to do. It simply won’t work due the way Ingress handles authentication.

2 Likes

Ah, ok. Thank you for the reply. :slight_smile:
I myself didnt get that clear answer through my skull yet. I was looking/waiting for a fix… ghehe.
Thanks for clarifying.
Cheers

@frenck
I saw on github the issue is closed, also a hint on that the ingress issue should be fixed now. Am I correct? If so, could you give a hints on how to set it up.

Iframe, influx+grafana should be such that I dont see the 401 message anymore?

What I tried is this in the grafana addon setup.
“grafana_ingress_user”: “admin”
should it be like this? anything else?
kindly tips :slight_smile:

regards