gpt4 book ai didi

javascript - 必须使用事件访问 token 来查询有关具有开放图的当前用户的信息

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:27:06 26 4
gpt4 key购买 nike

大家好,我正在尝试发布我的 Facebook 应用程序用户的事件,我按照教程一步步操作,但它无法正常工作...

警报消息显示错误“发生错误必须使用事件访问 token 来查询有关当前用户的信息”为什么?我登录正确。

代码是这样的:

<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US"
xmlns:fb="https://www.facebook.com/2008/fbml">
<head prefix="og: http://ogp.me/ns# appnamespace:
http://ogp.me/ns/apps/appnamespace#">
<title>OG Tutorial App</title>
<meta property="fb:app_id" content="appID" />
<meta property="og:type" content="appnamespace:recipe" />
<meta property="og:title" content="Stuffed Cookies" />
<meta property="og:image" content="http://www.domain.com/logo.gif" />
<meta property="og:description" content="The Turducken of Cookies" />
<meta property="og:url" content="http://www.domain.com/activity.php">

<script type="text/javascript">
function postCook()
{
FB.api(
'/me/namespace:cook',
'post',
{ recipe: 'http://www.domain.com/activity.php' },
function(response) {
if (!response || response.error) {
alert('Error occured '+ response.error.message); // it shows "Error occured An active access token must be used to query information about the current user." message
} else {
alert('Cook was successful! Action ID: ' + response.id);
}
});
}
</script>
</head>
<body>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'appID', // App ID
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
};

// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
</script>

<h3>Stuffed Cookies</h3>
<p>
<img title="Stuffed Cookies"
src="http://www.domain.com/logo.gif"
/>
</p>

<br>
<form>
<input type="button" value="Cook" onclick="postCook()" />
</form>
</body>
</html>

最佳答案

我在您的源代码中没有看到您对用户进行身份验证的任何地方。用户必须首先授权您的应用程序,如下所述:https://developers.facebook.com/docs/authentication/client-side/

关于javascript - 必须使用事件访问 token 来查询有关具有开放图的当前用户的信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11781123/

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