由于我刚开始接触Facebook API,我已经对它的文档进行了大量的研究,并根据文档找到了一种方法来更改基本应用程序的设置。这里:https://developers.facebook.com/docs/graph-api/reference/application
所以我先试了一下:
$.post('/v2.5/'+appSec,{canvas_url:'https://apps.facebook.com/ognjen', secure_canvas_url:'https://renotifier.com/canvas/399/ognjen'});它是对HTTP端点的Graph API调用。
在此之后:
var appSec = $('#appSec').val();
var appId = $('#appId').val();
console.log(appSec, appId);// catches everything totally fine
window.fbAsyncInit = function () {
FB.init({
appId: appSec,
cookie: true, // enable cookies to allow the server to access
// the session
xfbml: true, // parse social plugins on this page
version: 'v2.5' // use version 2.2
});
FB.api(
"/"+appId+"/?access_token="+appId+"|"+appSec,
"POST",
{
"canvas_url": "https://apps.facebook.com/ognjen",
"secure_canvas_url": "https://ognjen.com/canvas/ognjen/"
}
,
function (response) {
if (response && !response.error) {
console.log(response);
}
}
);
}但这些尝试都没有成功。我在这里也发现了类似的问题:How to change user's app settings on developers facebook profile?,和这里:Updating Facebook app settings via Graph API,并尝试了他们的答案,但没有奏效。对图形API有很好的认识的人,请帮帮忙,我被困住了。
更新
万一有人不知道,我正试图改变已经设置好的canvas_url和secure_canvas_url of Facebook应用程序。
发布于 2016-02-21 23:11:26
以下是工作要点:
https://gist.github.com/goranefbl/bbed8c255de9cbd91c92
顺便说一下。它可以工作,而无需将其作为event.subscribe的回调调用。
发布于 2016-02-21 21:06:17
尝试将Access令牌放在POST json中,而不是:
{
"canvas_url": "https://apps.facebook.com/ognjen",
"secure_canvas_url": "https://ognjen.com/canvas/ognjen/",
"access_token": appId + "|" + appSec
}https://stackoverflow.com/questions/35500599
复制相似问题