You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 8, 2021. It is now read-only.
Using username/password authentication to log in as an existing user with register == true, I get the "invalid credential" error code, not the "user already exists" error. Likewise, if I log in as a non-existent user with register == false, I get "invalid credential" instead of "user does not exist". Is this a bug?
I have checked that username/authentication is enabled on my instance and email validation is disabled. I can see that the users are being created the first time.
Goals
I would like to have special code to handle the case where the user already exists, but with the same error returned I can't distinguish this error from any other auth error.
Expected Results
userAlreadyExists error code (613)
Actual Results
invalidCredential error code (611)
Steps to Reproduce
Log in (registering a new user)
Log out
Log in again as the same user (register still set to true)
Handle error and check the code
Code Sample
let creds = SyncCredentials.usernamePassword(username: name, password: "password", register: true);
SyncUser.logIn(with: creds, server: Constants.AUTH_URL, onCompletion: { [weak self](user, err) in
if let _ = user {
// login successful
} else if let error = err as? SyncAuthError {
switch error.code {
case .userDoesNotExist: // never hit!
fatalError(error.localizedDescription);
case .userAlreadyExists: // never hit!
fatalError(error.localizedDescription);
case .invalidCredential: // this is always the case
fatalError(error.localizedDescription);
default:
break;
}
}
})
Using username/password authentication to log in as an existing user with register == true, I get the "invalid credential" error code, not the "user already exists" error. Likewise, if I log in as a non-existent user with register == false, I get "invalid credential" instead of "user does not exist". Is this a bug?
I have checked that username/authentication is enabled on my instance and email validation is disabled. I can see that the users are being created the first time.
Goals
I would like to have special code to handle the case where the user already exists, but with the same error returned I can't distinguish this error from any other auth error.
Expected Results
userAlreadyExistserror code (613)Actual Results
invalidCredentialerror code (611)Steps to Reproduce
Code Sample
Version of Realm and Tooling