Access through Companion app denied but okay through browser

I’m having an odd issue where I can’t connect to my Home Assistant instance externally from the Home Assistant Companion app, but I can access the cloud instance (nabu casa url) through my browser on the same device.

I can access Home Assistant fine through the app on my home network as well, just not externally.
Screenshots attached and logs below:

Login attempt or request with invalid authentication from localhost (127.0.0.1). Requested URL: '/auth/token'. (Home Assistant/2023.8.2-10992 (Android 13; M2102J20SG))
Login attempt or request with invalid authentication from localhost (127.0.0.1). Requested URL: '/api/websocket'. (Mozilla/5.0 (Linux; Android 13; M2102J20SG Build/TQ3A.230705.001.B4; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/116.0.0.0 Mobile Safari/537.36 Home Assistant/2023.8.2-10992 (Android 13; M2102J20SG))


Any idea why this might be the case?
It was fine previously, not sure anything has changed…

I have ‘Use Home Assistant Cloud’ enabled in the settings and have added my Home WiFi SSID and url for internal connection.

In the unable to connect pop-up click on settings then go to troubleshooting> show and share logs and pull the logs to see why it failed

First guess: have you enabled the “Can only log in from the local network” setting for this user? :slight_smile:

Find or check here: Settings > People > Users and click that user. In the popup directly under the name you can switch that setting.

Ah, my bad. I thought the logs were just what I pasted above.

That log is >300 lines, so I’ve pasted it here.

I don’t know what I’m looking at unfortunately.

Could it be something to do with Refresh tokens? I have a heap there and the last one related to 127.0.0.1 is:

Refresh token for https://[myurl].ui.nabu.casa/
Created last month
Last used 20 hours ago from 127.0.0.1 

Nope. Unchecked in settings. And using the same user I can log in to my cloud url from a browser fine. just not from the app.

Ya try to log out in the app and log back in should solve that issue.

Hmm… I had tried that and still had the same issue before posting. But maybe because I logged back in while on the home network?

Logged out and then logged in while on mobile data this time and was initially told unable to login due to untrusted network (as you’d expect), but used home assistant local login with user credentials and got in fine, and seems to be working okay when off home wifi.

Strange… Thanks for your help.

I don’t think you can login and get the proper token if using trusted network when logging into the mobile app. The token is probably only valid in the given circumstance.