Open botolonltd opened 2 years ago
It is still happening...
Same problem
In case it helps anyone, Im using NextJS and decided to go custom after some bugs with this module. Im using the following code (where the client id is being fetched - you can also read from a local env var or hardcode it and not need a useCallback hook around the init function):
const initFacebookSdk = useCallback(() => {
// wait for facebook sdk to initialize before starting the react app
window.fbAsyncInit = function () {
window.FB.init({
appId: FACEBOOK_OAUTH_CLIENT_ID,
cookie: true,
xfbml: true,
version: "v12.0",
});
};
// load facebook sdk script
(function (d, s, id) {
var js,
fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {
return;
}
js = d.createElement(s);
js.id = id;
js.src = "https://connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
})(document, "script", "facebook-jssdk");
}, [FACEBOOK_OAUTH_CLIENT_ID]);
useEffect(() => {
initFacebookSdk();
}, [initFacebookSdk]);
const getToken = () => {
window.FB.getLoginStatus(function (response) {
console.log("FB status", response);
if (response.status === "connected") {
// The user is logged in and has authenticated your
// app, and response.authResponse supplies
// the user's ID, a valid access token, a signed
// request, and the time the access token
// and signed request each expire.
const accessToken = response.authResponse.accessToken;
return onToken(accessToken);
} else {
return login();
}
});
};
const login = () => {
window.FB.login(
function (response) {
if (response.status === "connected") {
const accessToken = response.authResponse.accessToken;
return onToken(accessToken);
} else {
onError();
}
},
{ scope: "public_profile, email" }
);
};
// In my case, Im using a custom button and calling getToken as my onClick handler
Our App was working just fine and for whatever reason ours apps are not working anymore. Whenever someone "Continues with facebook" we get this error.