I’m trying add the Facebook login button to the Task tracker example app which I am running on an Android emulator on my laptop. I am using the React Native SDK. I have managed to register my app with Facebook and can get the login button showing. The LoginButton onLoginFinished
callback is as follows
const signInFacebook = async (error, result) => {
if (error) {
console.error(`Failed to log in: ${result.error}`);
} else if (result.isCancelled) {
console.log("Facebook login was cancelled");
} else {
const { accessToken } = await AccessToken.getCurrentAccessToken();
const credential = Realm.Credentials.facebook(accessToken);
const user = await app.logIn(credential);
setUser(user);
}
};
I can console.log
the accessToken ok but when I examine the credential
I see an empty object. The code then gives me this error:
Possible Unhandled Promise Rejection (id: 1):
Object {
"code": 2,
"message": "authentication via 'oauth2-facebook' is unsupported",
}
I have Facebook
and Email/Password
authentication turned on the Authentication Provider
tab of the Users
page. I hope this is a silly error, but I can’t seem to find much information when googling for this.
I can provide more information if necessary.