Reputation: 9730
I'm trying to authenticate a user with password like this:
let syncCredentials = SyncCredentials.usernamePassword(username: email, password: password, register: true)
SyncUser.logIn(with: syncCredentials, server: Constants.Realm.Server) { (realmUser, error) in
guard let realmUser = realmUser else {
DDLogError("\(error)")
return
}
DDLogInfo("realmUser: \(realmUser)")
}
but it prints out this error:
Optional(Error Domain=io.realm.sync Code=611 "The provided credentials are invalid." UserInfo={statusCode=400, NSLocalizedDescription=The provided credentials are invalid.})
The Server
constant is correct, as I can successfully connect to the Realm Object Server using Facebook credentials.
Upvotes: 0
Views: 1461
Reputation: 7340
You can get this error if you register the user that already exists, so specify register: false
if the user is already registered.
Upvotes: 1