amazon-archives / aws-cognito-angular-quickstart

An Angular(v5)-based QuickStart single-page app utilizing Amazon Cognito, S3, and DynamoDB (Serverless architecture)
https://cognito.budilov.com
Apache License 2.0
689 stars 304 forks source link

Requiring MFA causes client exception #121

Closed amirtoole closed 6 years ago

amirtoole commented 6 years ago

Using MFA (SMS) causes the following exception to be thrown on the client when a successful username/password has been sent.

Cognito responds with the following:

{"ChallengeName":"SMS_MFA","ChallengeParameters":{"CODE_DELIVERY_DELIVERY_MEDIUM":"SMS","CODE_DELIVERY_DESTINATION":"+*******3480"},"Session":"***removed***"}

Which causes the following client side exception:

ERROR Error: callback.mfaRequired is not a function
    at CognitoUser.authenticateUserInternal (CognitoUser.js:318)
    at CognitoUser.js:294
    at Response.<anonymous> (CognitoUser.js:260)
    at Request.<anonymous> (request.js:364)
    at Request.callListeners (sequential_executor.js:105)
    at Request.emit (sequential_executor.js:77)
    at Request.emit (request.js:682)
    at Request.transition (request.js:22)
    at AcceptorStateMachine.runTo (state_machine.js:14)
    at state_machine.js:26
    at Request.<anonymous> (request.js:38)
    at Request.<anonymous> (request.js:684)
    at Request.callListeners (sequential_executor.js:115)
    at Request.emit (sequential_executor.js:77)
    at Request.emit (request.js:682)
amirtoole commented 6 years ago

UserLoginService needs to implement mfaRequired callback when executing cognitoUser.authenticateUser.

PR incoming