gpt4 book ai didi

javascript - Iframe 应用程序 JavaScript SDK 发布对话框错误(代码 102)

转载 作者:行者123 更新时间:2023-11-30 18:31:16 24 4
gpt4 key购买 nike

我在通过 javascript SDK 发布对话框时遇到问题。它有时有效,有时无效。

它抛出这个错误:

API Error Code: 102 API Error Description: Session key invalid or no longer valid Error Message: Iframe dialogs must be called with a session key

我的代码:

  <script>
window.fbAsyncInit = function() {
FB.init({
appId : 'CENSORED', // App ID
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});

// wait a moment before showing dialog.
setTimeout("showbox()", 2 * 1000);
};

// 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>

and

<script>
function showbox()
{
FB.ui(
{
display: 'iframe',
method: 'feed',
name: 'ASD ASD ASD:',
link: 'https://apps.facebook.com/XXX/',
picture: 'https://skvelazabava.eu/XXX/yy.jpg',
caption: 'Největší alkoholici mezi tvými přáteli jsou:',
description: ' ',
properties: [{text:"XXX", href:"https://apps.facebook.com/XXX/"},
{text:"YYY", href:"https://apps.facebook.com/XXX/"} ],
redirect_uri: 'https://url.eu/'
});
}
</script>

我必须做什么才能确保对话具有 session key 。

最佳答案

我也是这种情况,为遇到此问题的其他人澄清:

<script>
window.fbAsyncInit = function() {
FB.init({
appId : '{{facebook_app_id}}',
app_token : '<%=@access_token%>',
status : true,
});

FB.getLoginStatus(function(response) {
console.log(response);

FB.ui({
method: 'apprequests',
message: 'Have you heard about Rell?',
data: 'invite-to-rell-42',
display: 'iframe',
filters: [{name: 'Daaku', user_ids: ['1677846385']}, 'app_non_users', {name: 'Games People', user_ids: [703, 6203644]}]
});

});


};

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

关于javascript - Iframe 应用程序 JavaScript SDK 发布对话框错误(代码 102),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9536542/

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