Login does not work even though credentials are valid.
M
Mark
started a topic
over 7 years ago
I am calling login with valid username and password, however the function never returns.
var promise = Kinvey.User.login('username', 'password');
promise.then(function(user) {
// User is now logged in. Never gets here.
});
1 Comment
M
Mark
said
over 7 years ago
The most common cause is that you are already logged in prior to calling `Kinvey.User.login` again. When this occurs, the library throws a "AlreadyLoggedIn" error:
var promise = Kinvey.User.login('username', 'password');
promise.then(function(user) {
// User is now logged in.
}, function(error) {
// An error occured (if you are already logged in, "AlreadyLoggedIn" will be returned).
});
If this is the case, try logging out the user first before logging in with another user (please inspect the `.then` flow carefully):
Mark
var promise = Kinvey.User.login('username', 'password');
promise.then(function(user) {
// User is now logged in. Never gets here.
});