-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resend MFA Code API #6676
Comments
doing |
@elorzafe @amhinson we are currently implementing that, but the authentication code does not always get sent. There some instances where calling
This is my current implementation within a on click event when a user clicks a resend-mfa code on a form. It will be really nice to have a resendMFA api call. This can benefit the community implementing MFA. |
@elorzafe Just to note when calling |
Seconding! This is an issue for me as well. Would be great if I could resend confirmation codes, without having to make users re-sign in. |
Yeah, also seeing this. We'll workaround with posting to |
This has been an issue for us for quite some time. I don't like having to hold on to a password in order to call Auth.signIn again for this feature, and asking users to sign in again is really clunky. |
@harrysolovay @elorzafe any movement on this? |
Has anyone heard any update on this issue? |
Just want to add my name to the list of people who would need this feature. |
Just want to add my name to the list of people who require this feature. |
This is a blocker on one of my projects as well. |
Same here... there's some update? |
+1, this is a needed feature |
+1 This is very basic feature request at this point. Specially since we would like to send a code to actually validate the MFA before actually enabling it, to confirm the user has access to the phone/email. |
+1 |
2 similar comments
+1 |
+1 |
Any update on this issue? This is a blocker on one of my projects as well. |
Need update on this |
Seeking update as well |
Is there any update on this? The given "workaround" of using |
+1, this is a needed feature |
CodeMismatchException: Invalid code or auth state for the userA closed issue had a discussion what @aoloo described. Interestingly, the issue was closed without having a solution which rendered the discussion to be locked which lead me to posting the solution here but since anyone who is searching this issue is lead to here, here is the solution: After receiving the code as SMS, do not trigger/call authenticate flow once again to send the SMS MFA code which causes the code to be invalidated and after getting the error you might notice another SMS MFA code being send which is due to the last authenticate call done to send initial SMS MFA code. Instead create another path or method in which you can use either In my case, I had built REST API's which calls the authenticate function within a Lambda.
import { CognitoUser } from 'amazon-cognito-identity-js';
// inside authenticate lambda function
const userData = {
Username: user.email,
Pool: userPool
};
const cognitoUser = new CognitoUser(userData);
cognitoUser.authenticateUser(authenticationDetails, {
onSuccess: ...,
onFailure: ...,
mfaRequired: (challengeName, challengeParameters) => {
const { Session } = cognitoUser;
if (payload.mfa === undefined) {
// returns mfaRequired response to frontend
resolve({mfaRequired: true, session: Session})
}
}
})
// inside sendSMSMFA function
const cognitoAdminUser = new CognitoIdentityServiceProvider({apiVersion: '2016-04-18'});
cognitoAdminUser.adminRespondToAuthChallenge({
UserPoolId: user_pool_id,
ClientId: client_id,
ChallengeName: 'SMS_MFA',
Session: payload.session,
ChallengeResponses: {
SMS_MFA_CODE: payload.mfaCode,
USERNAME: payload.email
},
}, (err, data) => {
if (err) {
console.log('error responding to auth challenge', err);
reject(err);
} else {
console.log('Successfully responded to auth challenge', data);
const idToken = data.AuthenticationResult.IdToken;
const AccessToken = data.AuthenticationResult.AccessToken;
const refreshToken = data.AuthenticationResult.RefreshToken;
resolve({token: idToken, access: AccessToken, refresh: refreshToken})
}
}) For anyone who wonders about why this isn't happening when using TOTP software token mehod is because the MFA code clock is separate of that of the cognito clock and thus there will always be a sync there even if codes are send in different |
+1337 |
?????? |
+1 |
4 similar comments
+1 |
+1 |
+1 |
+1 |
+1... blocker for my project. I will use the workaround for now, but as others have said, I do not want to cache the user's password. |
We were promised this was being worked on a almost two years ago. Most recent action I see is a closure of the related issue in aws-sdk-js as "not planned" in September 2023. This really is an essential (and easy to implement) feature. Too bad Amazon is a struggling 2-trillion-dollar company and doesn't have the resources to deal with the 500 open issues on this library that's arguably necessary to use their services. |
this feature is a must have. Any updates?? |
@evan-macgregor @rohith-dev10 I implemented this by doing a reauthentication. Is that not possible in your cases? |
Reauthentication is a disruptive and undesirable user experience. You would force the user to re-enter their credentials again. For security purposes, the user's credentials should never be stored by the web application. Every other IdP seems to support the ability to resend the MFA code because they offer API calls separate from Sign In/ Log In that allows the application to trigger a resend of the SMS MFA code. This seems like an essential feature that should be implemented. Is the thought here that since SMS is the least secure of the MFA options that AWS would prefer us to migrate away from SMS and use TOTP apps or other alternatives? |
@ashwinchandran13 Yeah, there's a workaround. That's not a feature or a fix, and as stated by many others, it's undesirable at best and insecure at worst. Don't pretend it's ok. I, like many others, choose to use AWS because the marketing claims it is feature-complete. This is not the case, and many services offered by AWS are in such a state. You've wasted my time by letting me get this far into implementation, and if you decided that it's not that important, I guess I'll just have to change my implementation to use one of the many other companies that offer very similar features. Luckily I've written my code to easily strip out AWS, since I've recognized that this would likely happen. |
It's incredibly disappointing. We chose Cognito based on AWS's branding, reputation, and the feature set promoted on their website. Resending a code is a basic, standard feature, and we didn't expect to encounter issues with it during the Cognito + Amply integration. We're seriously considering whether Cognito is the right fit for us moving forward. I hope other developers see this thread and avoid making the same mistake. |
I'm extremely frustrated and let down by this experience. We chose Cognito based on AWS's esteemed reputation. The ability to resend verification codes is a fundamental and essential feature, and encountering problems with it during the integration is both surprising and unacceptable. We are now seriously questioning whether Cognito can meet our needs moving forward. I urge other developers to heed this warning and consider alternative solutions to avoid facing similar issues. |
As an ex-architect from AWS, it is really shame seeing the Customer Obsession principle is deteriorating, given such a basic and essential feature does not raise any attention to AWS. (4 years, what are you doing AWS?) Of course there will be smarter person from AWS using 'has backbone' leadership principal to write a very long tech paper to illustrate/prove why such feature might not be a good idea to be implemented. |
October 2024 and anything new? |
I still use the
This solution avoids session mismatches and ensures that the resend and verification flows work seamlessly. |
still no solution from AWS? |
How can this still be open 4 years later, seems like theres nothing yet |
Is your feature request related to a problem? Please describe.
Our workflow MFA is required in Cognito via (SMS). The user enters the login username and password and is redirected to verify the MFA code page. Now comes the edge case where a user does not receive the MFA code due to network issues or other interference. Therefore we need to provide users with the option to resend an MFA code.
Describe the solution you'd like
A method to resend MFA Code due to some edge case a user does not receive a code within the initial sign In flow.
A similar hook to
Auth.resendSignUp()
but for MFA Code.Describe alternatives you've considered
Calling the
Auth.SignIn()
to resend MFA Code is not ideal because signIn requires a username and password.The text was updated successfully, but these errors were encountered: