Open webjunkie01 opened 4 weeks ago
Hi mate. Renew this.myPromise
in submitCode?:
submitCode(event:any){
this.resolvePromise(this.formComponent.value.code);
// renew the promise
this.myPromise = new Promise( (resolve, reject) => {
this.resolvePromise = resolve
})
}
Basically every time you need to provide a custom answer, the function that you pass to customChallengeAnswer
is invoked: so make sure that actually returns a new promise, or it will just resolve immediately with the old (wrong) value
smsMfaCode
works like that too
Thanks that works!
Hi Otto, I have another question.
Now that I have it working all that is left is to display a message to the user that a bad code has been submitted I've been looking at the code in srp.ts
trying to figure how could this work but I can't figure it out. Is this possible?.
So you mean after all 3 attempts have been wrong?
Cognito will throw the generic error "invalid username or password" then. The signIn promise will reject at that point. You can catch it then, and display an appropriate message as you see fit.
Hi guys,
I've been fiddling around with this package and I don't know how to handle the error when a bad code is submitted since the auth flow just loops infinitely here's my pseudo example in Angular.
Is there a way to catch the response and look at the challenge name to check if it's still
ChallengeName
to somehow abort but keep the session alive to make another retry?, what would be the best approach?