-
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
Authentication Cookie Storage Workflow not working #14129
Comments
Hey @sameer-dudeja, thanks for opening this issue! Can you share your package.json file? Looking at your environment information, it looks like you may have multiple competing amplify installations. |
Hi I am attaching the
|
Thanks for the follow up @sameer-dudeja I noticed that you are listing |
I tried that, now even in local, it is going directly to localStorage. I haven't changed any of the code. I am not sure whats happening. Should there be an error that logs from amplify side if the cookieStorage config is having some issues? |
Before opening, please confirm:
JavaScript Framework
React
Amplify APIs
Authentication
Amplify Version
v6
Amplify Categories
auth
Backend
None
Environment information
Describe the bug
I am configuring an Auth application in React using Amplify v6, while configuring the cookie storage as token storage, in my local system it works but when I deploy, It stops working and reverts back localStorage. I am attaching the screenshots, I was asked by AWS Amplify support to raise this issue as they couldn't figure it out as well.
There aren't any console/ api errors that we see when deploying to a hosted website.
In the local environment, it works. I am attaching the screenshot where the token are stored in cookies and also attaching the file for config reference
This is what i am using for localhost and it stores the token
cognitoUserPoolsTokenProvider.setKeyValueStorage(new CookieStorage({ domain: 'localhost', path: '/', secure: true, expires: 360 }));
and use the similar setting for deployed website which I am fine making public i.e. abs-login-testing.simulationhub.com which is a subdomain so updated the config and deployed this website.
cognitoUserPoolsTokenProvider.setKeyValueStorage(new CookieStorage({ domain: '.simulationhub.com', path: '/', secure: true, expires: 360 }));
but unfortunately it keeps reverting to localstorage not sure why.
Just as an update since we are the application, we have reverted the changes in the deployed website and implemented a manually implementation to store tokens but the internal functions should also work.
Expected behavior
When I am setting the storage to cookies. it should work no matter if it is deployed or on local.
Reproduction steps
Code Snippet
cognitoUserPoolsTokenProvider.setKeyValueStorage(new CookieStorage({ domain: 'localhost', path: '/', secure: true, expires: 360 }));
Log output
aws-exports.js
No response
Manual configuration
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered: