aws / aws-aspnet-cognito-identity-provider

ASP.NET Core Identity Provider for Amazon Cognito
https://aws.amazon.com/developer/language/net/
Apache License 2.0
213 stars 89 forks source link

Stuck in forgot password flow #175

Closed fredericof closed 3 years ago

fredericof commented 4 years ago

Description

Hello, I'm currently developing the forgot password flow with Cognito extension for ASP.NET and I'm stuck with the step when I receive the confirmation code on my email.

Reproduction Steps

Starting by calling ForgotPassword method that sends to my email a confirmation code, but when I set confirmation code at the ConfirmForgotPassword method, it throws ExpiredCodeException. Another weird thing I realized is that Account Status of User does not changes to "Enabled / RESET_REQUIRED".

Sample Code

ForgotPassword to request to change a user password

            try
            {
                ForgotPasswordResponse forgotPasswordResponse = await client.ForgotPasswordAsync(forgotPasswordRequest);
                response = new DTOCognitoForgotPasswordResponse()
                {
                    ConfirmationCodeWasDelivered = true
                };
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            return response;
        }

ConfirmForgotPassword to change the user password with the confirmation code

try
            {
                ConfirmForgotPasswordResponse confirmForgotPasswordResponse = await client.ConfirmForgotPasswordAsync(confirmForgotPasswordRequest);
                response = new DTOCognitoConfirmForgotPasswordResponse()
                {
                    PasswordWasChanged = true
                };
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

Thanks, Frederico

ashishdhingra commented 4 years ago

Hi @fredericof,

I'm not sure if it helps, the article User Authentication For Web And iOS Apps With AWS Cognito (Part 2) gives a good overview of the Forgot Password workflow. Please let me know if it helps.

Thanks, Ashish

github-actions[bot] commented 3 years ago

This issue has not recieved a response in 2 weeks. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled.