New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Keep me logged in" does not save token to localstorage #10676
Comments
So after playing around with this, I noticed that this only happens on the first time you load up the page (perhaps because the JavaScript chunks are still loading?). If you refresh after you've logged in, then it goes back to the login page but the token is now stored correctly. Note that clicking the logout button on the profile page "starts over", that is, it doesn't fix the issue. However, deleting the entry from local storage and refreshing correctly works. I'm still investigating more about this issue. |
I have just started having this issue. After it working as I would expect for a little over a week, suddenly I find myself being logged out while interacting with the UI. Logging in, and hitting refresh will bring me back to the login page. Sometimes I would be trying to add an automation (click the add automation button), something would flash on the screen (I assume the wizard, it goes away too fast to see what it was) and I'd end up just being logged out. So it definitely wasn't due to inactivity. Creating a new user and logging in with that user instead, seems to have fixed the issue, but I don't know for how long. I'm using home-assistant (latest tag) in docker on a synology nas following the official instructions, and for about a week it worked perfectly, then there was an update pushed to the docker registry, updated, and that's when the issues started. I tried going back to the old image (which I had saved to local storage) but even that previously working image was now broken too. Tried using the "stable" tag and still the same result, so I don't think the update was necessarily the cause. Happens in firefox and chrome, the only "solution" so far for me was to create a new user with a different login name. I tried removing all stored passwords, clearing cookies, clearing cache, logging out of the mobile app (in case that was somehow conflicting). I'm not entirely sure whether my issue is the same, but it seems very similar. |
@ntoff A workaround that I've found is to login, then refresh and login again. To check if you're correctly logged in, look if you have the Alternatively, you can execute this on the JavaScript console to save the tokens in memory to localStorage while logged in: localStorage.setItem("hassTokens", JSON.stringify(window.__tokenCache.tokens)) |
I can also confirm the same issue. I was able to reproduce it, but my initial analysis did not turn up what is going wrong. I think that when I had set some breakpoints, it worked with the first login directly, but when I wanted to confirm that again alter I wasn't able to...so not completely sure. But that might point to a timing issue potentially. |
Confirm this does seem to keep me logged in, and that my login isn't otherwise being saved to local storage without manually saving it. Weird that only one username (for me the user affected is "admin") is affected though? If there's anything else you need me to try, let me know. I have HA running through docker currently, but could just as easily set it up manually or throw it on a spare raspberry pi. |
hey. any update? same issue here |
Same issue here. Tried on multiple browsers and devices. |
I have the same problem as other users that from version 2021.11.x that it doesn't remember my login details in the Android app. The problem occurred when I reinstalled the ha application, so i don't have how to use the development tools or f12 on my phone with Android 11 |
this is fixed in the current beta |
I see this is closed, can you tell us in which version this is fixed? I am experiencing similar issues, but running higher version |
Checklist
Describe the issue you are experiencing
It seems like the new "Keep me logged in" button does not store the token to local storage as one would expect. It is kept in memory and lost when the tab is closed.
Describe the behavior you expected
Ticking the "Keep me logged in" checkbox should actually leave you logged in and store the token to local storage.
Steps to reproduce the issue
test
with passwordtest123
)What version of Home Assistant Core has the issue?
core-2021.11.5
What was the last working version of Home Assistant Core?
core-2021.10.*
In which browser are you experiencing the issue with?
Brave 1.32.106 (Chromium 96.0.4664.45) - Also tested on Firefox 94.0.2
Which operating system are you using to run this browser?
ArchLinux (Kernel 5.15.3-arch1-1)
State of relevant entities
No response
Problem-relevant frontend configuration
No response
Javascript errors shown in your browser console/inspector
No response
Additional information
Probably introduced by #10226
The text was updated successfully, but these errors were encountered: