Guide
Home Assistant "Login attempt or request with invalid authentication from"
The log line behind the notification carries the requested URL and the client's user agent, and those two name the device. We triggered each common source against Home Assistant 2026.10.4 and recorded the line, the counter and the ban.
How do you find what causes "Login attempt or request with invalid authentication" in Home Assistant?
Open the log, not the notification. The notification ends with "See the log for details". The matching WARNING line from homeassistant.components.http.ban adds Requested URL: '<path>' and the client's user agent in brackets. The path says what failed: /auth/login_flow is a typed password, /auth/token is an app with a revoked or expired refresh token, /api/websocket is an open browser tab or tablet, and any other /api/ path with a Python or curl agent is a script, integration or monitor with a dead token.
Read the log line, not the notification. The notification stops at "See the log for details". The log line adds two things: the URL that was requested and the client's user agent. Together they name the device. Here is a revoked phone app token, as our test instance logged it:
WARNING (MainThread) [homeassistant.components.http.ban] Login attempt or request with invalid authentication from c-refresh_revoked.halab (10.250.7.32). Requested URL: '/auth/token'. (Mozilla/5.0 (iPhone; CPU iPhone OS 26_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Home Assistant/2026.10 (io.robbie.HomeAssistant; build:2026.1000; iOS 26.1) Mobile/HomeAssistant, like Safari)The path /auth/token says a refresh token was refused. The agent says it was the iPhone app. Log out of the app and log in again, and the warnings stop.
To see the line, go to Settings > System > Logs, pick Home Assistant Core and turn on Show raw logs. Search for http.ban. On a Container install it is also in home-assistant.log in the config folder.
The terms this answer turns on#
"Login attempt or request with invalid authentication" is a warning written by homeassistant/components/http/ban.py. It fires when a request to Home Assistant's web server fails its login check. That covers a wrong password, but also any app, tab or script whose token no longer works. So it is not proof of an attack.
An access token is the short-lived key a client sends with each request. A refresh token is the long-lived key an app uses to get new access tokens from /auth/token. Home Assistant creates one each time you sign in on a device. The docs say you delete one under User profile > Security "to force that device to sign out". One unused for 90 days is removed. Changing your password and choosing to sign out other sessions does the same to every other device. A long-lived access token is the kind you make for a script.
The user agent is a line every HTTP client sends to say what it is. A browser sends Mozilla/5.0 ..., a Python script Python/3.14 aiohttp/3.14.5, curl sends curl/8.14.1.
An IP ban blocks every request from one address with 403 Forbidden. It is written to ip_bans.yaml in the config folder.
The URL and user agent, mapped to the cause#
We ran Home Assistant 2026.10.4 in Docker and made each source fail from its own container. Every row below logged the warning shown, except the two marked "not logged".
| Requested URL | User agent | What it is | Fix |
|---|---|---|---|
/auth/login_flow/<id> | A browser or the app | Someone typed a wrong password or 2FA code | Your own device: nothing. A public address: that is the attack bans are for |
/auth/token | Home Assistant/<version> (companion app) | App holding a deleted, expired or foreign refresh token | Log out of the app and log in again |
/api/websocket | A browser | A tab or wall tablet holding a token that no longer works | Reload the tab and log in |
/api/states, /api/services/... | Python/... aiohttp/... or another library | Script, Node-RED, AppDaemon or an integration with a deleted long-lived token | Make a new token and paste it in |
/api/ | curl/... or a monitor's name | Uptime check with no token | Give it a token, or check the port only |
/api/camera_proxy/<entity>?token= | A browser | A dashboard card for a camera entity that no longer exists | Remove or fix the card |
/api/camera_proxy/<entity>?token= on an existing camera | A browser | Stale image token | Not logged: answered 403 |
/api/states with banning off | Any | Dead token | Not logged: answered 401 silently |
The first four rows match what users post. Issue 85024 shows an iPhone on /auth/login_flow and the iPhone app on /api/history. The localhost thread shows /api/websocket 806 times within hours of a server rebuild. That fits: a rebuilt instance never issued the tokens that old tabs and apps still hold.
The host name before the address comes from a reverse DNS lookup. In our Docker network it gave container names, such as c-login.halab. When the lookup fails, the address appears twice, as in 10.250.7.1 (10.250.7.1). That one was our own readiness check, hitting /api/ from the Docker host with no token. An uptime monitor doing the same needs a long-lived token in its request, or a plain port check instead.
Camera lines: a regression and a quiet rule#
Most camera reports in the forums come from June 2026. Pull request 173082 shipped in 2026.6.1. It made a stale camera token answer 401 instead of 403, and its author said so in the description. A 401 counts as a failed login, so live camera cards started banning their own viewers. Issue 173202 shows /api/camera_proxy_stream/...?token=undefined and /api/camera_proxy/...?authSig=... from a desktop Firefox. The change was reverted in pull request 173466, released in 2026.6.3. If you run 2026.6.1 or 2026.6.2, upgrade.
In 2026.10.4 the rule is back. A camera request without an Authorization header and with a bad token gets 403 and is not logged. Our test confirmed it. Two camera requests still count. One carries a bad bearer token in the header. The other asks for a camera entity that does not exist, which gets 401. That second one is the card left on a dashboard after you removed a camera. Delete the card, or point it at the new entity.
Two answers circulate, and neither finds the device#
"Turn off IP banning." This was the workaround in the 2026.6.1 thread. It hides more than it fixes. With banning off, Home Assistant does not install the part that logs plain 401 responses. Our wrong password, /auth/token and websocket attempts were still logged. The script on /api/states, the curl check and the missing camera all got 401 with no log line at all. They are still failing. You just stopped hearing about it. Each script or integration on that list needs a new long-lived token from User profile > Security.
"It's your cameras" or "it's your proxy." Each is sometimes right. The localhost thread has a camera theory, a user with no cameras who saw the same line, and a fix in the phone app's network settings. None of these is a diagnosis. The URL and user agent are, and they are already in your log.
One more claim needs correcting. A wrong trusted proxies setting does not make the warning show the proxy's address. A proxy that sends X-Forwarded-For from an untrusted address gets 400 before any login check. Our test logged Received X-Forwarded-For header from an untrusted proxy and no login warning. That case is in Home Assistant 400 Bad Request behind a reverse proxy. The proxy's address appears when the proxy sends no X-Forwarded-For at all.
How the counter and the ban work#
From ban.py in 2026.10.4, and checked in our lab with a threshold of 3:
- Off by default. A fresh install stores
ip_ban_enabled: trueandlogin_attempts_threshold: -1. Below 1, the code logs the warning and stops. Nothing is counted. - Per address, in memory. A successful login from that address clears its count. So does a restart. Two failures, a restart, then one more failure did not ban us.
- No time window. The count has no timestamp. Failures a day apart add up the same as failures a second apart.
- The ban starts with the next request. Our third failure got the normal login form back. The next request from that address got 403. The log said
Banned IP 10.250.7.51 for too many login attempts, andip_bans.yamlgained the address with abanned_attime. - Only one notification. Every warning replaces the last one, under the ID
http-login. Seven failures from seven clients left one notification, naming the last. - The Supervisor is exempt. On Home Assistant OS, the Supervisor's own address is never banned, per the code. Nothing else is, 127.0.0.1 included. We did not run Home Assistant OS.
The settings are under Settings > System > Network, in the HTTP server section since 2026.8: Enable IP banning, Login attempts before ban, and Unlimited login attempts. Saving restarts Home Assistant, and an unconfirmed change reverts after 5 minutes. The 400 guide shows that trap.
The dev branch changes two details. It limits the reverse DNS lookup to 1 second, and it counts the failure before that lookup. The message text is unchanged.
A worked case: every failure from localhost#
Suppose Home Assistant runs in Docker with host networking. nginx on the same machine proxies to 127.0.0.1:8123. The notification says "from localhost (127.0.0.1)" every few minutes.
Open the raw log. Suppose the lines read Requested URL: '/api/websocket' with an iPad Safari agent. The URL points to a tab holding a dead token. The agent points to the iPad. That is the wall tablet. Its token stopped working, perhaps because someone deleted its refresh token. Reload the dashboard on the tablet and log in.
Now look at the address. 127.0.0.1 means nginx is not passing the client's address. Every user behind nginx shares that one address. If you set Login attempts before ban to 5, the tablet alone would ban 127.0.0.1 within minutes. Then every user coming through nginx gets 403. We saw the same thing with a Caddy that dropped X-Forwarded-For. One client failed three times, Caddy's address was banned, and a second client with a valid token got 403.
So fix nginx before you turn bans on. Have it send X-Forwarded-For, and add 127.0.0.1 to Trusted proxies. Why container logs show 172.17.0.1, not the client IP explains why loopback hides the client. The next warning will then name the tablet's own address.
Lifting a ban#
- Open
ip_bans.yamlin the config folder. Do it from a device that is not banned, or on the host. - Delete the address line and the
banned_atline under it. The docs say you may also delete the whole file. - Restart Home Assistant.
Skip step 3 and nothing changes. The file is read only at startup. We emptied it, and the banned address still got 403 until the restart. Bans do not expire.
When this answer stops applying#
This guide reads the log; it does not judge your exposure. A failed login from a public address you do not recognize, on /auth/login_flow, is a real attempt. Do not unban it, and do not raise the threshold to quiet it. Decide whether the login should face the internet at all, with A security baseline for a home server and Remote access without port forwarding. Home Assistant OS, its add-ons, the Supervisor exemption and IPv6 were not in our lab. Before 2026.8, the same two settings were ip_ban_enabled and login_attempts_threshold under http: in configuration.yaml.
What to do next#
Turn on Show raw logs, search for http.ban, and read the URL and the agent. Match them to the table, and fix the device it names. If the address is your proxy's or 127.0.0.1, fix the proxy before you enable bans. The Home Assistant profile lists the rest of its upkeep.
Questions#
Where do I find the Home Assistant log for a failed login?
Go to Settings > System > Logs, select Home Assistant Core and turn on Show raw logs. The grouped view can hide the URL. Search for http.ban. On a Container install the same lines are in home-assistant.log in the config folder and in docker logs. On Home Assistant OS there is no log file in the config folder; use the Logs page or ha core logs.
Does "Login attempt failed" mean someone is hacking my Home Assistant?
Usually not. In our tests a wrong password, a revoked app token, an old browser tab, a script with a deleted token and an uptime check all wrote the same warning. Read the address and user agent. A LAN address with your own browser or app is your own device. A public address with an agent you do not recognize, on /auth/login_flow, is someone trying passwords, and that is what IP banning is for.
Why does the log say localhost (127.0.0.1) for every failed login?
A reverse proxy on the same machine reaches Home Assistant on 127.0.0.1 and does not pass the client's address. We reproduced it with a Caddy that stripped X-Forwarded-For: the warning read "from localhost (127.0.0.1)". Fix the proxy so it sends X-Forwarded-For, and trust it in the HTTP server settings. Until then, a ban would block every user who comes through that proxy.
How do I unban an IP address in Home Assistant?
Delete that address and its banned_at line from ip_bans.yaml in the config folder, then restart Home Assistant. Editing the file is not enough on its own. In our test, an emptied file still left the address blocked with 403 until the restart. Bans never expire by themselves, per the documentation.
Why do I get the warning but Home Assistant never bans anyone?
Because counting is off by default. In 2026.10.4 a fresh install stores ip_ban_enabled: true but login_attempts_threshold: -1, which means no limit. With -1, the code logs the warning and returns before it counts anything. Set Login attempts before ban under Settings > System > Network to turn bans on.
Does turning off IP banning stop the warnings?
Only some of them. With banning off we still got the warning for a wrong password, a revoked refresh token on /auth/token and a bad websocket token. Requests to other /api/ paths, camera paths included, got 401 with nothing logged. That hides the scripts and cards that are failing. It does not fix them.
Sources#
- Home Assistant core, dev branch, http/ban.py (message format, counter, Supervisor exemption, reverse DNS)
- Home Assistant core 2026.10.4, http/ban.py
- Home Assistant core 2026.10.4, camera/__init__.py (403 versus 401 on camera_proxy)
- Home Assistant core 2026.10.4, websocket_api/auth.py
- Home Assistant documentation, HTTP integration (IP banning, ip_bans.yaml)
- Home Assistant documentation, Logger (viewing logs)
- Home Assistant documentation, Authentication (refresh tokens, 90-day cleanup)
- home-assistant/core pull request 173082, Unify query token auth in http views (2026.6.1)
- home-assistant/core pull request 173466, revert of 173082 (2026.6.3)
- home-assistant/core issue 173202, Repeated failed logins from loading live videos
- home-assistant/core issue 85024, IP banning problem with http integration
- Home Assistant community, Update to 2026.6.1 causes login failures (June 2026)
- Home Assistant community, Login attempt or request with invalid authentication from localhost (127.0.0.1) (2023 to 2026)
Published . Last reviewed . Found something out of date? Tell us and we will fix it and log the change.