amplify-js: TypeError: user.sendMFACode is not a function
aws-amplify, v0.1.36 (non-React version).
While calling confirmSignIn:
Auth.confirmSignIn(this.user, this.confirmationCode)
.then(data => this.handleResponse(data))
.catch(err => this.handleError(err));
I’m getting the following error:
TypeError: user.sendMFACode is not a function
I checked the user object and it doesn’t have this function, so not sure where the disconnect is. The actual registration is successful. Here’s the code that fails: https://github.com/aws/aws-amplify/blob/fc8722ee79f5a691843901af3729be57dbadba0b/packages/aws-amplify/src/Auth/Auth.ts#L247
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 15 (2 by maintainers)
Getting the same error with react-native. aws-amplify version 0.2.14
TypeError: user.sendMFACode is not a functionSomehow the CognitoUser object received in response of Auth.signIn(username,password) doesn’t have this sendMFA function. It does contain
challengeName : "SMS_MFA"I am experiencing the same issue in Angular
Hey @vbudilov just wanted to confirm. The user object in your call to Auth.confirmSignIn, was it from signIn method response? Also, need to make sure the challengeName was ‘SMS_MFA’.
Something like this:
Or keep user object to be used later:
Thanks, @asalia-marine. I’m using redux-saga as well. I have the
Auth.confirmSignUpworking, just getting hung up withAuth.confirmSignInas the user object fromAuth.signIndoes not return theuser.sendMFACodefunction as the issue suggests. Do you know the difference between redux-saga and redux-thunk in relation to how the Amplify endpoints might return objects? I’m curious too if there is a way to write thesendMFACodefunction into the code itself if the object is not going to return it.