Cannot login to web UI from desktop browser

TL;DR: login to HA fails with desktop web browsers, but works on Android mobile browser or app

Hi all,

I have followed the instructions here to install HA with Docker Compose on a NAS. On my ISP router, I have configured a free dyndns service to get a domain name, and opened the 8123 port. I mostly use the Android app to control HA, and everything has been working flawlessly since a few months.

I have recently tried to login from a distant desktop PC using Chrome and got an error message: “Unable to connect to Home Assistant. Retrying in 60 seconds…”. Clicking on the “Retry now” link just resets the countdown. I have also tried Firefox and Edge and the same problem occurs every time. I have cleared the browsers’ cache to no avail. This is not related to bad typing of the login/password as they are stored in my Google account.

From my Android phone (either on home wifi or 4G connection), I can login to HA with Chrome browser, but login fails again if I turn on the “Desktop site” option.

I would much appreciate your help on this problem, thank you all!

What if any extensions do you have installed?

Have you tried disabling dns prefetching?

Are you familiar / have you poked around with/in the browsers developer tools to see if anything jumps out? (network tab may give good clues)

Thanks for your reply!

No extensions installed so far.

Sorry I don’t know what dns prefetching is. How can I disable it?

I tried Chrome developer tools and got an error message in the Network tab:

Request URL: http://XXXXX.org:8123/auth/token
Request Method:POST
Status Code:400 Bad Request
Remote Address: 192.168.254.20:8080
Referrer Policy: same-origin

I also got two errors in the console:

POST http://XXXXXX.org:8123/auth/token 400 (Bad Request)
	c @ auth.js:47
	d @ auth.js:65
	l @ auth.js:163
	F @ core.ts:64
	(anonymous) @ core.ts:102
	(anonymous) @ core-_QvDdm__sa4.js:1
lovelace:1 Uncaught (in promise) 2
	Promise.then (async)
	(anonymous) @ core.ts:112
	(anonymous) @ core-_QvDdm__sa4.js:1
1 Like