Login attempt or request with invalid authentication from supervisor (172.30.32.2)

Hi, I am having this issue and I have no idea how to deal with it, I have done my own research but have no clue, thanks in advance.

Error in the notification every time I restarted HA

Notification

Login attempt failed
Login attempt or request with invalid authentication from supervisor (172.30.32.2). See the log for details.

Log

Login attempt or request with invalid authentication from supervisor (172.30.32.2). (HomeAssistantSupervisor/2021.09.6 aiohttp/3.7.4.post0 Python/3.9)
05:25:57 – (WARNING) HTTP

Log Details

Logger: homeassistant.components.http.ban
Source: components/http/ban.py:124
Integration: HTTP (documentation, issues)
First occurred: 05:25:57 (1 occurrences)
Last logged: 05:25:57

Login attempt or request with invalid authentication from supervisor (172.30.32.2). (HomeAssistantSupervisor/2021.09.6 aiohttp/3.7.4.post0 Python/3.9)

Configuration

http:
server_port: 443
ssl_certificate: /ssl/fullchain.pem
ssl_key: /ssl/privkey.pem
use_x_forwarded_for: true
trusted_proxies:
- 192.168.8.0/24
- 192.168.5.0/24

1 Like

Are you actually using Nginx? Because it doesn’t look like you are, in which case - you don’t need the trusted proxies, or Use X Forwarded for.

Additional followup - do you have Zigbee2MQTT installed but not set up yet?

Hi thanks for the reply,

I do not have Zigbee2MQTT installed but I do have an integration (Xiaomi Gateway 3) that has Zigbee2MQTT option and it is not enabled.

I tired uncomment the below rebooted HA and it went safe mode, end up I added it back and HA back to normal. :-/

use_x_forwarded_for: true
trusted_proxies:
- 192.168.8.0/24
- 192.168.5.0/24

gave up, re-setup to solve it. anyway thanks.

I have completely cleaned up my system and reinstalled Home Assistant Supervised - and the docker it is running in - three times - and I consistently keep getting the same error. Therefore I am trying to resolve the issue instead of blowing everything away and reinstalling because that is useless. I do not have any MQTT installed. My Home Assistant (supposedly supervised but that is BS right now) is running on a Raspberry PI 4B w/8GB of RAM booting from and running on a 1TB SSD card, connected to my internal network by ethernet. In my syslog every 5 seconds I am getting this:

Feb 3 15:15:31 kruse-pi hassio-supervisor[2368]: #033[31m22-02-03 15:15:31 ERROR (MainThread) [supervisor.homeassistant.api] Can’t update Home Assistant access token!#033[0m
Feb 3 15:15:31 kruse-pi 54b763e0df01[1151]: #033[31m22-02-03 15:15:31 ERROR (MainThread) [supervisor.homeassistant.api] Can’t update Home Assistant access token!#033[0m

Also from within home assistant UI (which has no “supervisor” option on the left pane - and never has because I have always had this error message so it seems like a myth to me), I am getting this error message:

“Login attempt or request with invalid authentication from 172.30.32.2 (172.30.32.2). See the log for details.”

on the pi, in this directory: home/pi/ha (myuserid is “pi”), this file - home.assistant.log - has this line repeating every 5 seconds as well:

2022-02-03 20:24:26 WARNING (MainThread) [homeassistant.components.http.ban] Login attempt or request with invalid authentication from 172.30.32.2 (172.30.32.2). (HomeAssistantSupervisor/2022.01.1 aiohttp/3.8.1 Python/3.9)

I have searched everywhere and have seen other people resolving this issue by removing that IP from an ip_bans file (there is no such file on my system anywhere), or making some kind of a tweak to their MQTT (I don’t even have that installed at all)…

Any help anyone can provide would be VERY DEEPLY appreciated!

I have the exact same issue

Hello, I seem to be stuck on the same problem. Did anyone manage to resolve it or has some hints?

I useds to have the issue but it went away. Not sure if this helps, but I do have Adguard running in a container in home assistant and acting as my dns server, 172.30.32.1 is one of the IP’s upon which adguard is listening for dns requests… The above problem I originally had went away, but I had to reinstall home assistant so many times when I was first starting I don’t know whether it was a version upgrade, or what that fixed the issue…

1 Like

I was seeing the exact same errors that the OP. Also, my Lovelace left-hand menu was missing all my Add-ons and the ‘Add-Ons’ menu missing from the Settings page.

My homeassistant.log file would show this entry over and over:

2023-02-09 23:27:58.394 WARNING (MainThread) [homeassistant.components.http.ban] Login attempt or request with invalid authentication from supervisor (172.30.32.2). Requested URL: '/auth/token'. (HomeAssistantSupervisor/2023.01.1 aiohttp/3.8.3 Python/3.10)

Running ha supervisor logs from the terminal would display a lot of these errors:

23-02-09 23:23:37 ERROR (MainThread) [supervisor.homeassistant.api] Can't update Home Assistant access token!
23-02-09 23:23:37 ERROR (MainThread) [supervisor.homeassistant.api] Can't update Home Assistant access token!
23-02-09 23:23:37 ERROR (MainThread) [supervisor.homeassistant.api] Can't update Home Assistant access token!

I tried rebooting, waited 48 hours, still not working. I tried running all the ha commands I could. None resolved my problem.

# ha core rebuild
Error: Unknown error, see supervisor

# ha authentication cache
Command completed successfully.

# ha supervisor repair
Command completed successfully.

This issue appeared after a power bump and HASS did not cleanly shutdown.

I spent a few hours searching online but I could not find what was wrong. I kept on digging, started looking at the supervisor python code and discoveredthat the supervisor lost it’s homeassistant refresh_token.

The refresh_token is property in /mnt/data/supervisor/homeassistant.json that allows the Supervisor to communicate with HomeAssistant. As you can see below, there is no refresh_token property:

# cat /mnt/data/supervisor/homeassistant.json
{
"ssl": false,
"audio_input": null,
"audio_output": null,
"boot": true,
"watchdog": true,
"uuid": "e1263b5c50c5030c67a8441b282c8840 ",
"port": 8123,
"version": "2023.1.7",
"image": "ghcr.io/home-assistant/qemux86-64-homeassistant"
}

To fix this, I had to locate the Supervisor’s refresh_token from the homeassistant auth database and add it to the supervisor configuration file, homeassistant.json.

Here’s how I did it:

# cd /mnt/data/supervisor/

# # First make a backup of the current file, just in case.
# cp homeassistant.json homeassistant.json.backup

# # Extract the Supervisor userid from the homeassistant auth database.
# export sup_id=$(cat homeassistant/.storage/auth | jq -r '.data.users[] | select(.name == "Supervisor") | .id'); echo $sup_id
8f7e53535353c88d

# # Next extract the refresh_token value for the Supervisor account
# export sub_token=$(cat homeassistant/.storage/auth | jq -r '.data.refresh_tokens[] | select(.user_id == env.sup_id) | .token'); echo $sub_token
4640dc8a2069799e00c1ebcd046241e6ec9d82053dd0ddab141ad98e65866bcaf00085bf37f563b0496a1c50267b23df7a73bff1efe6857951f3daeb2138cf39

# # Now add this token to a temporary Supervisor configuration file.
# cat homeassistant.json | jq '. += {"refresh_token": env.sub_token }' | tee homeassistant.json.with_token
{
"ssl": false,
"audio_input": null,
"audio_output": null,
"boot": true,
"watchdog": true,
"uuid": "e1263b5c50c5030c67a8441b282c8840 ",
"port": 8123,
"version": "2023.1.7",
"image": "ghcr.io/home-assistant/qemux86-64-homeassistant",
"refresh_token": "4640dc8a2069799e00c1ebcd046241e6ec9d82053dd0ddab141ad98e65866bcaf00085bf37f563b0496a1c50267b23df7a73bff1efe6857951f3daeb2138cf39"
}

# # Finally, you have to stop the supervisor before replacing the config file. Give it enough time before moving on.
# docker stop hassio_supervisor
# mv homeassistant.json.with_token homeassistant.json
# docker start hassio_supervisor
# sleep 30

# # Rebuild core to fix and sync up everything again.
# ha core rebuild
Command completed successfully.

I reloaded my Lovelace UI and everything worked!.

6 Likes

You’ve helped me a lot! Thanks!

Thank you. Just had the same issue 5 hours ago and finally found this thread and it cured my problem.

I had the same issue but occasionally… once every few days…
Do you think it’s the same issue described here or something else?

Login attempt or request with invalid authentication from supervisor (172.30.32.2). Requested URL: ‘/api/config’. (HomeAssistantSupervisor/2023.04.1 aiohttp/3.8.4 Python/3.10)

I have the same issue. It seems to have started after updating to 2023.5.x. Just wondering if it has anything to do with “Voice Assistant”.

Thx, @Simon10 - saved my evening, for sure. I had the same issue after shutting down my virtual machine via LXC instead of from within the virtual machine, so I guess an unclean shutdown of the supervisor can trigger this refresh_token issue.

Note: I skipped one step in your sequence, and had to manually change $sup_id with $sub_token because of that, and it also worked, so maybe a simple “ha core rebuild” would have sufficed in my case :confused: :slight_smile:

I had the issue before - similar setup to one of the posters and similar symptoms, so I just thought I’d share:

Setup

  • HAOS running in VM on Proxmox
  • stopped and rebooted every night for vm-level backups (which has save me several times!)

Symptons

  • Would have the “login attempt failed” notification every day
  • Sometimes (once or twice a week) various integrations (often helpers, but others too) would fail to come up
  • Doing a reboot from within settings would fix these issues 99% of the time

Fix (no issues so far!)

  • Did a backup (from within home assistant)
  • Did a clean install of HAOS on a new VM (as I’m using Proxmox I followed these instructions: Installing Home Assistant OS using Proxmox 8)
  • Restore the backup from the welcome setup screen.
  • Fix some networking stuff (Disable https, Login with the web UI and set the IP, Re-enable https)