Iulian Onofrei
Iulian Onofrei

Reputation: 9750

Facebook log in with Realm throws status code 400 error

I logged in with Facebook and then used this code:

let facebookCredentials = SyncCredentials.facebook(token: FBSDKAccessToken.current().tokenString)

SyncUser.logIn(with: facebookCredentials, server: Constants.Realm.Server) { (user, error) in
    if let user = user {
        print("\(user)")
    } else if let error = error {
        print("\(error)")
    }
}

and it outputs:

Optional(Error Domain=io.realm.sync Code=3 "(null)" UserInfo={statusCode=400})

What am I doing wrong?

Upvotes: 0

Views: 246

Answers (1)

Iulian Onofrei
Iulian Onofrei

Reputation: 9750

The problem was that I skipped this part of the documentation which requires you to enable the Facebook authentication on the server by editing the configuration.yml and then sudo service realm-object-server restart.

Upvotes: 1

Related Questions