I am trying to write integrated testing on my current project when I try to authenticate a user with the amazon-cognito-auth-js library, and then I got an error of
code: {"UserNotFoundException", message: 'User does not exist.'}
It is hard for me to find out the reason, but I am pretty sure all the user information are correct, wondering if some error in the configuration. Also, the project I am working on using a 3rd party auth (oneLogin), is there any possibility happens on that side's configuration. But I am not sure since the actual auth system in the real application works pretty fine.
async login(username, password) {
const authenticationData = {
Username: username,
Password: password
};
var authenticationDetails = new AuthenticationDetails(authenticationData);
var poolData = {
UserPoolId: poolid,
ClientId: clientid
};
var userPool = new CognitoUserPool(poolData);
var userData = {
Username: username,
Pool: userPool
};
var cognitoUser = new CognitoUser(userData);
cognitoUser.authenticateUser(authenticationDetails, { // error here
onSuccess: function (result) {
//...
},
onFailure: function(err) {
//...
}
});
}
Appreciated for the help of any kinds.
Update:
After I try the fake userpool data, the error is still 'user not found", probably I need to enable some specific setting to use this?
I am trying to write integrated testing on my current project when I try to authenticate a user with the amazon-cognito-auth-js library, and then I got an error of
for the code I used below, it is actually the example 4 of https://docs.aws.amazon.com/cognito/latest/developerguide/using-amazon-cognito-user-identity-pools-javascript-examples.html.
It is hard for me to find out the reason, but I am pretty sure all the user information are correct, wondering if some error in the configuration. Also, the project I am working on using a 3rd party auth (oneLogin), is there any possibility happens on that side's configuration. But I am not sure since the actual auth system in the real application works pretty fine.
Appreciated for the help of any kinds.
Update: After I try the fake userpool data, the error is still 'user not found", probably I need to enable some specific setting to use this?