Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a Facebook access token that has enough rights to get the posts in which you're tagged in?

The Facebook posts in which you're tagged in - using @Name - appear in your wall feed.


A friend of mine posted a link and tagged me in it:

The startup Guide


On the Graph API documentation, when I click on my wall feed link (Ctrl + F: Profile feed), I'm able to see this post:

  ...
  {
     "id": "XXX",
     "from": {
        "name": "XXX",
        "id": "XXX"
     },
     "to": {
        "data": [
           {
              "name": "XXX",
              "id": "XXX"
           },
           {
              "name": "Christophe Maillard",
              "id": "XXX"
           }
        ]
     },
     "message": "The startup Guide (cc XXX, Christophe Maillard)",
     "link": "http://mashable.com/2012/06/27/startup-guide-1000-users/",
     "name": "How to Get to Your First 1,000 Users",
     "caption": "mashable.com",
     "description": "With the help of some smart marketers and entrepreneurs, we're created a clear outline for attracting your startup's first 1,000 users.",
     ...
  }
  ...

The URL of this feed is https://graph.facebook.com/me/feed?access_token=XXX.


When copy/pasting the given access token - the one replaced by XXX in the URL above - within the debugger, I get something like this:

Access Token Debugger

As we can see, the access token is generated by the app Test_console which used quite a lot of scopes.


Then, I go to the Graph API Explorer, I generate an access token using the Get Access Token button, and I specify all the scopes the debugger gave me, i.e. the ones the Test_console app used to generate its working access token. Finally, I access the URL me/feed by submitting the GET request. The problem: I can't see the post in question in which I'm tagged in with the explorer.

I also have my own app, and it reacts exactly like the Graph API Explorer: I can't find that post in my wall feed using the Graph API as well.

Obviously, it's possible to get the posts in which you're tagged in using the Graph API, because the Test_console app is able to generate an appropriate access token. But how can I get such an access token for my own app?

like image 251
sp00m Avatar asked Jul 03 '12 13:07

sp00m


People also ask

How do I get Facebook access token that never expires?

If you want to make sure your Facebook page access token never expires, click “Debug” button. If you can see “expires: never”, it means Facebook page access token will never expire.

How long do Facebook access tokens last?

When your app uses Facebook Login to authenticate someone, it receives a User access token. If your app uses one of the Facebook SDKs, this token lasts for about 60 days. However, the SDKs automatically refresh the token whenever the person uses your app, so the tokens expire 60 days after last use.

What is an access token on Facebook?

Facebook access token is an opaque string which is used to identify the user, application, or page and can be applied by the application to make graph API calls. Getting token for Facebook page is absolutely free.


1 Answers

You need to grant the appropriate permissions for your app. In the graph api explorer https://developers.facebook.com/tools/explorer?method=GET&path=me switch to your app in the applications field (top right) to see what permissions that currently grants your app (by clicking the "get access token" button again). Then make sure you add in the correct one (i think it's read_stream you're after ) https://developers.facebook.com/docs/authentication/permissions/

like image 85
TommyBs Avatar answered Nov 01 '22 10:11

TommyBs