简体   繁体   中英

Facebook Graph API and Generic Access token

If I understand correctly, the Graph API enables access to public pages using a generic access token. I'm finding however that many public pages are not returned in search results when using this type of token vs. a user token. I don't want users to have to go through an OAUTH dialog just to retrieve the basic properties of a public page.

This example below returns a result when using any user access token but no results when using a generic access token:

What am I doing, or understanding, incorrectly?

https://graph.facebook.com/search?q=OSullivansHerndon&type=page&access_token={myuseraccesstoken}

https://graph.facebook.com/search?q=OSullivansHerndon&type=page&access_token={APPID|APP SECRET}

You can get a generic access token for your app that will let you look at requests where you would otherwise need an access_token= parameter in the Graph call. You don't need to authenticate users as the access token is for the application.

https://graph.facebook.com/oauth/access_token?
client_id=YOUR_APP_ID&
client_secret=YOUR_APP_SECRET&
grant_type=client_credentials

example:

https://graph.facebook.com/nike/posts?access_token={response from above call}

I suspect you need a user access token to use /search as search results use social context. If you have the page id, you can load that without any access token by just hitting /id

I dont think you can get this to work without a user access token. From my limited OAUTH is the only way forward.

By specifying GRAPH API user token, you simply meant that you are using user preferences and information . if your intention is to fetch some public page information , then you need that page userid or username . And , if you are intention is to grab all the public data which is available for your particular user , then you have to pass oAUTH system,Since indirectly you are accessing his information which is meant public under some facebook govern rules .

Accessing public page by providing user id

https://graph.facebook.com/19292868552

By writing the id of that page,you ca access its information. Now the question is how to access the id of that particular page, Manually just visit that page --> photo album . on the top of that page,you will see something like " Album Videos " . Just visit any of that link.now see,woola the id of that page is visible to you . something like this url

    http://www.facebook.com/media/albums/?id=176101909092314

And btw,if you are interested in performing search , then you need to specify user token. facebook do some algorithmic search for all users and track user activities . So , the result will not always the same for you and me , as an example .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM