-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
bug: auth by Hosted UI does not persist in localstorage #1426
Comments
@jadbox I tried in my localhost without any issue. The items with key |
@powerful23 Well I definitely know localstorage is not being cleared out, as the other cognito keys (can't remember them exactly) and even some test keys I add are persisted when the page reloads. It seems like specifically all keys Here's a snippet of the code I was using: |
@jadbox I looked through your code snippet. There are some places you might need to change.
Thanks. |
@powerful23 wow, that did it! I should have noticed point #1 though. THANK YOU. I've been banging my head on this for nearly 3 weeks. Please do document as much as possible :) |
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs. Looking for a help forum? We recommend joining the Amplify Community Discord server |
Bug Report
Problem: after successful login, reloading the page without the code token does not persist authenticated state. It seems to be a localstorage issue where Amplify is clearing the
CognitoIdentityServiceProvider
keys out.I cannot get Amplify to persisted an authenticated state after logging in via the Hosting UI [oauth]. I tried both Implicit Token and Code Grant, with cookies and with localstorage. The initial login works when the code/token is in the url, but once the page is refreshed and the uri token is removed, Amplify no longer says the user is authenticated.
On initial authentication (when
?code=xx
on the url) I do see that localstorage correct get populated withCognitoIdentityServiceProvider
keys , but once I remove the code/token from the url and reload, the keys in storage seem to disappear. I've tried creating a test localstorage token and it stays persisted upon reload, but theCognitoIdentityServiceProvider
keys do not.It might be related to:
amazon-archives/amazon-cognito-identity-js#287
(cc @crowdwave)
The text was updated successfully, but these errors were encountered: