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

Up to date ? #2

Open
Rodriguevb opened this issue Dec 19, 2020 · 1 comment
Open

Up to date ? #2

Rodriguevb opened this issue Dec 19, 2020 · 1 comment

Comments

@Rodriguevb
Copy link

Hello sirdiego. Is this repo still up to date?
I get this error by using the method this.$auth.loginWith( ... )
Can you tell me what I should add to my strategy? Thank you

TypeError: callback.newPasswordRequired is not a function
    at CognitoUser.authenticateUserInternal (CognitoUser.js?3c43:466)
    at eval (CognitoUser.js?3c43:344)
    at eval (CognitoUser.js?3c43:323)
    at eval (Client.js?1610:119)
@psgganesh
Copy link

psgganesh commented Feb 25, 2022

This packages works just perfect. Just use a try catch and rest of the callbacks can be handled the way you need.

methods: {
    async login() {

      try {

        await this.$auth.loginWith("cognito", {
          data: { username: this.username, password: this.password },
        });
        console.log(this.$auth);

      } catch (e) {
        
        console.log("Exception occured, which could not be handled by lib!");
        console.log(e.stack);
        const state = (e.message.split(".")).pop().split(" ").shift().toUpperCase();
        
        switch(state) {
          case "NEWPASSWORDREQUIRED": 
            this.newPasswordRequired();
            break;
          default:
            console.log("Exception to be handeled for "+state);      
        }
      }

    },
    newPasswordRequired() {
      console.log("Navigate to new password page!!!");
    }
  }

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