Generic "Invalid Code" or "User not found" error when implementing SSO workaround for Amazon Cognito

0

Due to an issue with the PreSignUp trigger and AdminLinkProviderForUser command, I am following the workaround described by an AWS support engineer in the linked re:Post forum to implement single sign-on for my application that uses Amazon Cognito.

https://repost.aws/questions/QULY1qbV21TYqrnVnNdpdpqQ/remove-external-identity-from-cognito-user

The TL:DR of the workaround above is that the AdminLinkProviderForUser command is used in the PostConfirmation trigger. However to do this, we first have to delete the automatically created external IdP user to prevent the command from throwing an error.

Depending on which OAuth flow that I choose for single sign-on, such as the authorization code, or the implicit grant, I get an 'invalid code' or 'user not found' error instead of receiving the JWT tokens that I need for my application when applying this workaround. I suspect that the error is because I delete the user that the authorization token or the implicit grant is supposed to be for, but then how did the AWS support engineer successfully retrieve JWT tokens back?

Has this been an issue with anyone else? I'm fairly certain I implemented everything in the same manner (except that it is written in JavaScript), but I just simply cannot get it to work.

P.S. Any updates on fixing the SSO bug from any AWS employees? More details about this bug described here: https://repost.aws/questions/QUgWVkIodQS1W3Yj8MYjInbA/cognito-auth-flow-fails-with-already-found-an-entry-for-username-username

질문됨 2년 전269회 조회
1개 답변
0

Hi!! Did you found a work around for this issue. Im having the same issue trying to change de code using the oauth2/token endpoint.

smunoz
답변함 8달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠