OAuthException “(#210) 主题必须是一个页面。”

发布于 2024-12-19 12:15:51 字数 612 浏览 5 评论 0原文

即使我使用的是页面访问令牌而不是应用程序访问令牌,我仍然收到 OAuthException (#210) subject must be a page. 错误。

我正在使用以下内容:

  1. 来自 facebook 的最新 JavaScript SDK (//connect.facebook.net/en_US/all .js
  2. 使用以下代码调用 /{PAGE_ID}/tabs?app_id={APP_ID}&method=POST&access_token={PAGE_ACCESS_TOKEN}用户登录后使用 FB.api 方法。

我的应用程序不是 FBML,而是 Canvas / iFrame 应用程序。我做错了什么?

我研究了网络,包括 Stackoverflow 和其他 Facebook 论坛,但仍然没有答案。我的应用程序已启用 OAuth。

另外,如果我将链接复制并粘贴到浏览器中,它就可以正常工作。如果我使用 API 则不会。

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:

  1. Latest JavaScript SDK from facebook (//connect.facebook.net/en_US/all.js)
  2. 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

空‖城人不在 2024-12-26 12:15:51

我终于让它工作了。

但是,我没有使用 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 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);
    }
白云悠悠 2024-12-26 12:15:51

对于再次遇到此错误的任何人:
当我使用 wininet 将 https 请求发布到 https://graph.facebook.com/< 时,我收到了相同的错误消息/a>……

我只是将动词从“POST”更改为“GET”,然后就可以正常工作了:

//string strVerb = "POST";
string strVerb = "GET";

PS:变量“strVerb”用作windows函数HttpOpenRequest的第二个参数。

To anybody who gets this error again:
I have get the same error message while I use wininet to post a https request to https://graph.facebook.com/......

I just changed the verb from "POST" to "GET" , and then it works well:

//string strVerb = "POST";
string strVerb = "GET";

PS: variable "strVerb" is used as the 2nd parameter of windows function HttpOpenRequest.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文