Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OAuthException "(#210) Subject must be a page."

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.

like image 203
Dinesh Jain Avatar asked Dec 06 '11 07:12

Dinesh Jain


People also ask

What does OAuthException mean?

OAuthException: If you receive an OAuthException error, it means that Edgar doesn't have the correct permissions to access your Facebook accounts right now. The password may have been changed on Facebook or Facebook may have reset your security session.

What is a graph API?

The Graph API is the primary way to get data into and out of the Facebook platform. It's an HTTP-based API that apps can use to programmatically query data, post new stories, manage ads, upload photos, and perform a wide variety of other tasks.

What is Fbtrace_id?

fbtrace_id : Internal support identifier. When reporting a bug related to a Graph API call, include the fbtrace_id to help us find log data for debugging.


1 Answers

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);
    }
like image 160
Dinesh Jain Avatar answered Oct 03 '22 21:10

Dinesh Jain