cypress-realworld-app
cypress-realworld-app copied to clipboard
Amazon Cognito Authentication v6 unsupported
AWS Amplify v6 was released on Nov 15, 2023, with several breaking changes. The examples on the website and in the repo doesn't work with the new version.
@innellea
- There is an open documentation PR https://github.com/cypress-io/cypress-documentation/pull/5610 related to this change.
If you want to view a preview of the documentation change, with the addition of v6 information, you can find it here. ~~It hasn't been approved yet, however it may help you in the meantime.~~
I'm very happy to see that you reached out, @innellea . I noticed the same thing and pieced together how to convert to v6, and wanted to contribute back my learnings, which is why I opened https://github.com/cypress-io/cypress-documentation/pull/5610 . Thank you @MikeMcC399 for your response in discord and your pointer here! I would not have found this issue in cypress-realworld-app without it.
Turns out the documentation update was declined, but to anyone finding this page, that closed PR 5610 does have a working example.
@timheilman
Turns out the documentation update was declined, but to anyone finding this page, that closed PR 5610 does have a working example.
Where do you read that the documentation update was declined? I am seeing that you yourself closed the PR
I don't see any note that the Cypress.io team declined the documentation update.
Oh, maybe I was confused. I thought that was how a decline was processed: that the PR was assigned to the submitter. I don't have write access to the repo, so I had no way to move the PR forward. The only further action I could take without any comments, review, or approval was to close it, so I figured that's why she assigned it to me.
@timheilman
Oh, maybe I was confused. I thought that was how a decline was processed: that the PR was assigned to the submitter. I don't have write access to the repo, so I had no way to move the PR forward. The only further action I could take without any comments, review, or approval was to close it, so I figured that's why she assigned it to me.
Although I don't understand the logic of assigning a PR to the submitter of the PR, it certainly does not mean that the PR was declined.
I suggest you go back and re-open the PR and then be patient. Your PR is out of necessity quite complex, so reviewing it is more demanding and may take more time.
oh, okay, that was my mistake. I reopened it.
If you're encountering problems with JWT (access and ID tokens) in Amplify, one aspect to verify is whether Amplify is correctly configured to use localStorage as your token storage mechanism.
While the Amplify documentation indicates localStorage as the default, [email protected] opted for cookies instead, I spent a few hours debugging this.
import { Amplify, type ResourcesConfig } from 'aws-amplify';
import { defaultStorage } from 'aws-amplify/utils';
import { cognitoUserPoolsTokenProvider } from 'aws-amplify/auth/cognito';
const authConfig: ResourcesConfig['Auth'] = {
Cognito: {
userPoolId: 'your_user_pool_id',
userPoolClientId: 'your_user_pool_client_id'
}
};
Amplify.configure({
Auth: authConfig
});
cognitoUserPoolsTokenProvider.setKeyValueStorage(defaultStorage);