Skip to content Skip to sidebar Skip to footer

Create Facebook Access Token Without Logging In

I want to receive the public posts of a defined facebook page in my app. I already integrated the FacebookSDK and created a new app in the Facebook developer console. My Request lo

Solution 1:

Even for public posts, you have to authorize the user in order to get access. Either with read_stream to get ALL posts or with user_status to get the posts of the user only.

read_stream will most likely not get approved by Facebook though, see this document: https://developers.facebook.com/docs/facebook-login/permissions/v2.2

Keep in mind that "public" does not mean you can grab it without user authorization. Apps can´t just scrape what they want - scraping is not allowed anyway: https://www.facebook.com/apps/site_scraping_tos_terms.php

Also, of course you can´t create a User Token (which is what you need) without user interaction (login and authorization). Detailed information about Access Tokens can be found in the following links:

Btw, the docs mention that "Any valid access token is required to view public links." - So you may be able to get links only.

Source: https://developers.facebook.com/docs/graph-api/reference/v2.2/user/feed

For debugging Access Tokens, use the Facebook Debugger: https://developers.facebook.com/tools/debug/

Edit: I just realized that you just want to grab the public feed of a Facebook Page, not a User Profile. For that, you can just use an App Access Token. It´s never expiring and easy to create: App-ID|App-Secret. Check out the docs for more information. Keep in mind that you would need to use a User Token or Page Token if the Page is restricted by age or country.

Solution 2:

Have a look at https://developers.facebook.com/docs/graph-api/reference/v2.2/page/feed/

The permissions needed to be able to request /{page_id}/feed:

  • An access token is required to view publicly shared posts.
  • A user access token is required to retrieve posts visible to that person.
  • A page access token is required to retrieve any other posts.

Meaning you could generate a long-living Page Access Token to be able to retrieve the public Page Posts. As you won't want to store an expiring Access Token in your App, you'll have to create a backend web service to proxy the requests between the Graph API and your app.

See

You should also be able to use an App Access Token, which is valid indefinitely.

Solution 3:

Use client token.

You could also generate and sign your own personal token but you don't want to distribute that.

Post a Comment for "Create Facebook Access Token Without Logging In"