cypress-realworld-app icon indicating copy to clipboard operation
cypress-realworld-app copied to clipboard

Amazon Cognito Authentication v6 unsupported

Open raverecursion opened this issue 1 year ago • 7 comments

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.

raverecursion avatar Jan 29 '24 20:01 raverecursion

@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.~~

MikeMcC399 avatar Jan 30 '24 18:01 MikeMcC399

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.

timheilman avatar Jan 30 '24 23:01 timheilman

Turns out the documentation update was declined, but to anyone finding this page, that closed PR 5610 does have a working example.

timheilman avatar Feb 05 '24 16:02 timheilman

@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 image

I don't see any note that the Cypress.io team declined the documentation update.

MikeMcC399 avatar Feb 05 '24 17:02 MikeMcC399

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 avatar Feb 05 '24 17:02 timheilman

@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.

MikeMcC399 avatar Feb 05 '24 17:02 MikeMcC399

oh, okay, that was my mistake. I reopened it.

timheilman avatar Feb 05 '24 17:02 timheilman

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);

raverecursion avatar Apr 04 '24 00:04 raverecursion