Skip to content
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

FORCE_CHANGE_PASSWORD state not handled #45

Open
joefresco opened this issue Sep 21, 2017 · 1 comment
Open

FORCE_CHANGE_PASSWORD state not handled #45

joefresco opened this issue Sep 21, 2017 · 1 comment

Comments

@joefresco
Copy link

joefresco commented Sep 21, 2017

About a year ago, amazon-cognito-identity-js changed the way that userConfirmationNecessary works.

Here is what vue-auth-cognito has

  return new Promise(function (resolve, reject) {
   return cognitoUser.authenticateUser(authDetails, {
     onFailure: function onFailure(err) {
       reject(err);
     },
     onSuccess: function onSuccess(session, userConfirmationNecessary) {
       commit(types.AUTHENTICATE, constructUser(cognitoUser, session));
       resolve({ userConfirmationNecessary: userConfirmationNecessary });
     }
   });
 });

Note the onSuccess function

Here is amazon-cognito-identity-js use case 23.
Note the newPasswordRequired: function that is used now.

cognitoUser.authenticateUser(authenticationDetails, {
    onSuccess: function (result) {
        // User authentication was successful
    },

    onFailure: function(err) {
        // User authentication was not successful
    },

    mfaRequired: function(codeDeliveryDetails) {
        // MFA is required to complete user authentication.
        // Get the code from user and call
        cognitoUser.sendMFACode(mfaCode, this)
    },

    newPasswordRequired: function(userAttributes, requiredAttributes) {
        // User was signed up by an admin and must provide new
        // password and required attributes, if any, to complete
        // authentication.

        // the api doesn't accept this field back
        delete userAttributes.email_verified;

        // Get these details and call
        cognitoUser.completeNewPasswordChallenge(newPassword, userAttributes, this);
    }
});

Currently, for a user with a current state of FORCE_CHANGE_PASSWORD the error is

Uncaught Error: callback.newPasswordRequired is not a function
at eval (CognitoUser.js?88ac:252)
at Response.eval (CognitoUser.js?88ac:220)
at Request.eval (request.js?1405:364)

@marcoarruda
Copy link

Same issue here, still not handling?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants