OAuthException“(#210)主题必须是页面。” [英] OAuthException "(#210) Subject must be a page."
问题描述
我不断获得OAuthException (#210)主题必须是一个页面。
错误,即使我使用页面访问令牌而不是应用程序访问令牌。
我正在使用以下内容:
- 最新的JavaScript SDK从Facebook (//connect.facebook.net/en_US/all.js )
- 使用FB调用
/ {PAGE_ID} / tabs?app_id = {APP_ID}& method = POST& access_token = {PAGE_ACCESS_TOKEN}
.api方法一旦用户登录。
我的应用程序是不是FBML ,而是一个Canvas / iFrame应用。我做错了什么?
我已经研究过网络,包括Stackoverflow和其他Facebook论坛,但仍然没有回答。对于我的应用,OAuth已启用。
另外,如果我将浏览器中的链接复制并粘贴到正常工作中。
我终于找到了。
但是,不用使用FB.api来调用上面的链接,而是使用jQuery。
我使用jQuery$ .getJson(url ),它的工作。
它的工作原理如下。
构建如下链接。 >
https://graph.facebook.com/{PAGE_ID}/tabs?app_id={APP_ID}&method=POST&access_token={PAGE_ACCESS_TOKEN}&callback=?
调用jQuery方法如下。
$ .getJSON(pageUrl,OnCallBack);其中OnCallBack是回调方法。你可以在回电中做任何你需要的事情。在我的情况下,它是像下面这样。
function OnCallBack(r,s){
var html =;
if(s ==success&!r.error){
for(p in r){
html + = p +:+ r [p] +< br />;
}
} else {
html = r.error.message;
}
$(#dv)。html(html);
}
I Keep getting OAuthException (#210) Subject must be a page.
error even if I am using the Page Access Token and not the App Access Token.
I am using the following:
- Latest JavaScript SDK from facebook (//connect.facebook.net/en_US/all.js)
- Calling the
/{PAGE_ID}/tabs?app_id={APP_ID}&method=POST&access_token={PAGE_ACCESS_TOKEN}
using the FB.api method once the user is logged in.
My Application is not FBML but a Canvas / iFrame App. What am i doing wrong?
I have researched the web including the Stackoverflow and other facebook forums but still no answer on this. OAuth is Enabled for my Application.
Also, If i copy and paste the link in Browser it works fine. It does not if I do it using the API.
I finally got it working.
However, Instead of using the FB.api to call the link above, i used jQuery.
I used jQuery "$.getJson(url)" and it worked.
It works as below.
Construct the link as below.
"https://graph.facebook.com/{PAGE_ID}/tabs?app_id={APP_ID}&method=POST&access_token={PAGE_ACCESS_TOKEN}&callback=?"
Call the jQuery method as below. "$.getJSON(pageUrl, OnCallBack);" where "OnCallBack" is the call back method. You can do anything that you would need in the call back. In my case it was something like below.
function OnCallBack(r, s) {
var html = "";
if (s == "success" && !r.error) {
for (p in r) {
html += p + ": " + r[p] + "<br />";
}
} else {
html = r.error.message;
}
$("#dv").html(html);
}
这篇关于OAuthException“(#210)主题必须是页面。”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!