Authentication Cookie Storage Workflow not working #14129
Labels
pending-maintainer-response
Issue is pending a response from the Amplify team.
pending-triage
Issue is pending triage
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: