I'm trying to add Login with FB on my react website.
FB.init({
appId : app_id,
cookie : true,
xfbml : true,
version : 'v5.0'
});
Followed by
FB.getLoginStatus(({status}) => {
if (status === 'connected') {
FB.logout();
}
FB.login((response) => {
if (response.authResponse) {
const {authResponse: {accessToken}} = response;
onSuccess(accessToken);
} else {
onError({error: 'popup_closed_by_user'});
}
}, {scope: 'email'});
})
But it's opening the popup the first time (when getLoginStatus is not connected) and then the 2nd time it shows an error on the console
Uncaught b { innerError: undefined, message: "Expression is of type undefined, not function" }
Upon further investigation, I found that the error happens when the line FB.logout() is called.
What might I be doing wrong?
NOTE The same code was working until yesterday.
from FB.logout in JS project gives error "Expression is of type undefined, not function"
try this, it works for me.
ReplyDeletehttps://stackoverflow.com/questions/67196231/fb-logout-in-js-project-gives-error-expression-is-of-type-undefined-not-functi