Hi, I’m getting an error when trying to log in to Facebook. With the same problem many people have encountered and tried everything I can see. But I did not succeed.
I had the same problem in my project as well. In my case it was because the user was already logged into Facebook via my app. I solved it by always making sure to logout of Facebook on logout
You can also check to see if the user is already logged in before attempting the login again:
this.facebook.getLoginStatus().then((res) => {
if (res.status === 'connected') {
// Already logged in to FB so pass credentials to provider (in my case firebase)
let provider = firebase.auth.FacebookAuthProvider.credential(res.authResponse.accessToken);
firebase.auth().signInWithCredential(provider).then((authToken) => {
this.authToken = authToken;
});
} else {
// Not already logged in to FB so sign in
this.facebook.login([]).then((userData) => {
// FB Log in success
}).catch((error) => {
// FB Log in error
});
}
};
Changed the values in the config.xml but it didn’t took effect. I had to remove and add it again with the correct APP_ID (that was wrong, found the problem after uninstalling the facebook and the web popup told me the APP_ID was unusual. After this it worked