OAuthException “(#210) Subject must be a page.”

空扰寡人 提交于 2019-12-01 01:09:51

问题


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.


回答1:


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);
    }



回答2:


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.



来源:https://stackoverflow.com/questions/8396384/oauthexception-210-subject-must-be-a-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!