Grafana tab on Home Assistant throws “401 Unauthorized” Error

I decided view my temperature sensors via Home Assistant,

So I have installed a Grafana plugin on HA, configured data sources, created a dashboard and VIOLLA!!

it works, I’m seeing a graph with all the data from my DS18B20 temperature sensors (I got 3 of them).

Then I decided to display it in a card that will be configured as a webpage, which I did, and once again I’m able to see the graph on one of my HA tabs when I’m connected straight to the machine where HA is located…

at first, I was like

but then I was all

when I tried to watch the tab from another computer and got the “401 Unauthorized” error

then I thought to myself, hmmm…. What was I thinking? That can’t be that easy… but that’s okay, I’ll just google it and fix it in a couple of minutes…

at this point I didn’t understand that it’ll take more than a couple of minutes before I’ll manage to fix that annoying authorization thing.

So have googled the error and I am not the only one that stumbled upon this, and after about 15 minutes of reading forums I still didn’t get the answer how to solve this thing, it was already late at night and I told myself “fuck it, I’ll go to sleep now, will handle this tomorrow” and that I did.

On the next morning while my kids were eating breakfast I tried once again to find a solution…
I got here: https://community.home-assistant.io/t/home-assistant-community-add-on-grafana/54674/141 and understood that until veriosn 3.0.0 was released we could integrate graphics from Grafana as “iframe” with url: http: //: 3000, but scince v3.0.0 something changed… the ingress support was added and Grafana plugin stopped exposing the “3000” port, and you couldn’t anymore open Grafana as a standalone session.

From now on the correct way to use Grafana plugin for being able to watch the graph from remote location without the “401: Unauthorized” error is with the following settings:

  1. This should be the Grafana plugin configuration:
plugins: []
env_vars:
  - name: GF_AUTH_ANONYMOUS_ENABLED
    value: 'true'
ssl: true
certfile: fullchain.pem
keyfile: privkey.pem
  1. Additionally, you have to configure “network” and put the port “3000”
  2. Then you need to go to the grafana dashboard and get the link for the dashboard,
    paste the link in the iframe and change the port of the link from 8123 to 3000 and that will fix the “401 Unauthorized” error.

Leave a Comment