0

I am stuck trying to log into the Realm Object Server (ROS) from my app. I rolled my own log in scheme with a Keychain wrapper but would like to use Realm and the ROS with the cloud.

But I cannot write or find a simple way to log in using the username/password credentials. This is the server error: auth.password: Handle request failed with: InvalidCredentials: The provided credentials are invalid or a user does not exist.: Given account:

I am logged in to the ROS via the terminal and my cloud provider on the ROS dashboard. I can see my name and userID but it says I have no Realms.

How would connect my app to the server url to log in?

Here's something (among 10 different things) I've tried:

 private func setUpPermissions() {
    SyncUser.logIn(with: .usernamePassword(username: username, password: password, register: false), server: syncServerURL) { (user, error) in
        guard user != nil else {
            print(error!.localizedDescription)
            return
        }
        do {
           // This is where I get stuck
            print("Logged in successfully")
        } catch {
            print(error.localizedDescription)
            }
        }
    }
}

I haven't found ant of good examples (just code snippets) so apologies for my own code.

  • 1
    Does the Realm Object Server user already exist? If you log into the ROS dashboard and then click the 'Users' tab, is there a user whose "User Credentials" string is equal to the value of `username`? If not you need to set `register` to true. – AustinZ Sep 05 '17 at 21:43
  • Hi Austin. Yes, there is. –  Sep 05 '17 at 23:13
  • I filed an issue on GitHub with more detail. Not sure of best practice, now. Should I post a link here or re-ask the question with the relevant info? Thanks! –  Sep 05 '17 at 23:17
  • Setting the register to true worked. I can continue to log in even if I leave it to true. Is it rewriting the new user? I cannot see it on the server. Anyway, marking this answer as correct. –  Sep 06 '17 at 00:46
  • Being able to leave it `true` sounds like a bug. I'll take a look at your issue; we can continue the discussion there. Thanks! – AustinZ Sep 06 '17 at 01:29

0 Answers0