Alec Mather
Alec Mather

Reputation: 858

How to use an App Token with Facebook's Graph API

I'm trying to build an app that gets public information from Facebook. In the past, this type of operation would require an App Token (A token that could be used on behalf of the application to query public data). I had no problem implementing this technique with Twitter and Youtube, but Facebook looks like you can only access their API by letting a user login with Facebook via OAuth, retrieve them a personal token, and give them permission to query their own information.

I see a lot of posts related to this question, but they seem outdated. I know Facebook has been under a lot of privacy pressure lately and I'm wondering if they changed it.

Here are my questions:

  1. Is it possible to generate an App Token used to access Facebook's Graph API?

  2. If so, where can I find the documentation for this? I can only find information on using a user token.

I prefer to use Node.js as my backend, so any direction on where to start there would also be appreciated.

Upvotes: 1

Views: 169

Answers (1)

andyrandy
andyrandy

Reputation: 74014

  • User Profiles: They always require a User Token, there is no way to access User Data without explicit authorization of the User, no matter if data is public or not.
  • Pages: If you manage the Page, you can use a Page Token of that Page to access data. If you want to access other Pages, you need to apply for Page Public Content Access - after that, you can use an App Token for those Pages.

In other words: App Tokens for public Pages (with PPCA), Page Tokens for Pages you own, User Tokens for User Profiles.

Btw, App Tokens do not need to be "generated", they are just "App-ID|App-Secret" (with a pipe in the middle).

Upvotes: 1

Related Questions