I just started using AWS Cognito in my App, I followed instructions and installed Amplify and created User Pool and Identity pool and set up everything.
I created a signup form and signet up with no problems with Aut.signUp()
and confirmed email.
But when I tried logging in I entered my credentials and got NotAuthorizedException, Incorrect username or password.
I am logging in like this:
Auth.signIn(user.Username, user.Password)
.then((res) => {
AsyncStorage.setItem('token', JSON.stringify(user))
.then(res =>{
console.log('saved')
})
.catch(err=>{
console.log(err)
})
No matter what I enter in input fields I get this error. I just started using Amazon AWS and can't really think of a problem
So after a few days of trying to solve this, I found a solution.
In AWS config by default Authentication Flow Type is set to USER_SRP_AUTH
What you need to do is in your AWS config put:
authenticationFlowType: 'USER_PASSWORD_AUTH',
And then go to amazon cognito panel -> user pool - > app clients - >show details -> Enable username-password (non-SRP) flow for app-based authentication (USER_PASSWORD_AUTH).