"401: Unauthorized" iframe CARD of Grafana not working

Try to add additional parameters here, near of "GF_AUTH_ANONYMOUS_ENABLED" in Grafana configuration:

    value: 'true'
    value: canBeAnyNameHere

Now it’s working better in my Hassio, but only if connecting to it from same host

I had the same Issue (401 unauthorized) in the iFrame in a dashboard. Activating Grafana from the toolbar on the left and switching back to the dashboard helps for the second. On a mobile device on same network I always got 401 error.

The solution was to change the port in the embed addresse from default 8123 to the one you define in Grafanas settings (3000 on my setup). Credits to @joaofl


please can you post a screenshot where I can find in my setup yours 3000 address?

Supervisor -> Grafana -> Configuration -> Network

1 Like

mine is like this… I don’t know why… grafana is working… is there a way to fix this?


I guess there is a way :wink: simply type “3000” (or whaterever 4digit number you like) instead “disabled” like I did

this will probably work. Now I suppose to add my credentials (username + password) and I don’t remember them :frowning:

Cheers. Do you embed internal address or external one with https?

I can confirm that after I changed the port to 3000, the iframe panel showed up on may app.

When I connected to HA using same IP equals IP in URL in iframe, frame work properly/
But when I connected using duckdns.org host or using host from my hosts file, frame show error 401.
None of the above recipes helped.

Unfortunately, this problems still happens on my android mobile phone even change that port to 3000.

But on PC/Browser, it works always fine. Very strange.

1 Like

Same here. Android App with Tablet user isn’t working. Android App with my personal User on Smartphone works perfectly fine, also with my personal User on the PC browser.

Would be interesting to get this resolved for all devices.

1 Like

Hi, I have posted alternative solution for iframe with Grafana.
If you are running Home Assistant and Grafana on a reverse proxy and SSL enveronment, this might be useful.

Enabling anonymous login fixes this issue with setup like below but creates security problems. One way to fix that from HA side is to introduce sending additional headers for lovelace iframe card.
Grafana api keys can be used like this:

curl -H “Authorization: Bearer eyJrIjoiUnhKa2swM2FrR0k4eUhyUHQ5dDVoVzN3U2cwVdfgfdrjht554iaWQiOjF9” https://grafana.mysetup.org/api/hassio_ingress/nZYGqQ-X7eLkUZpNFdRU47lv_/api/dashboards/home

Then grafana api keys can be used but this also creates other security issues since the api key will be visible for everyone who can access the lovelace dashboard. Though it is a less severe issue than completely exposing grafana with anonymous login since if someone unwanted can access your dashboard, you will have other problems.
This can also be mitigated by using secrets in the lovelace ifrane card to some degree too.

    value: 'true'
    value: 'true'
    value: Org
    value: Viewer

There is an open feature request for this:

For me, no advice worked. I was able to display grafana panels from external adresses, but not now anymore. I only get jumping grafana logo.

I have the same issue.
I get an 401: Unauthorized error on a first opening lovelace page.
I have to open a grafana panel first and then I have to refresh a lovelace page


Same 401 issue… 2022.8.3.
I saw many different solutions out there, but… I’m a bit confused: after years of HA-Grafana integration… isn’t there, yet, a straight direction to solve an issue that ANYONE using Grafana in HA would have? I mean… anyone using Grafana - I think - would then add his graphs within the other dashboards… no?