gpt4 book ai didi

javascript - JS 项目中的 FB.logout 给出错误 "Expression is of type undefined, not function"

转载 作者:行者123 更新时间:2023-12-03 15:46:52 26 4
gpt4 key购买 nike

我正在尝试在我的 react 网站上添加使用 FB 登录。

FB.init({
appId : app_id,
cookie : true,
xfbml : true,
version : 'v5.0'
});
其次是
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'});
})
但它第一次打开弹出窗口(当 getLoginStatus 不是 connected 时),然后第二次在控制台上显示错误
Uncaught b { innerError: undefined, message: "Expression is of type undefined, not function" }
经过进一步调查,我发现错误发生在行 FB.logout() 时。叫做。
我可能做错了什么?
注意 直到昨天,相同的代码仍在工作。

最佳答案

好像是 FB.logout现在需要参数:cb .
https://developers.facebook.com/docs/reference/javascript/FB.logout/
不确定它何时成为强制性的,但没有它就无法工作。

关于javascript - JS 项目中的 FB.logout 给出错误 "Expression is of type undefined, not function",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67196231/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com