Facebook API: I want to silently (without dialog box) authenticate my server to access a fan page's info
The organization I'm creating a website for has a facebook fan page and I would like to feed the events tab on the website directly from the events that the fan page has created or is attending. The problem is I can't see, looking at the oauth documentation that FB provides, how to retrieve an access token without forcing the website user to deal with the auth dialog box (which the user should not have to deal with). And yes the fan page graph i开发者_Python百科s requiring authentication for access to the events.
This should be simple but I'm just not seeing how to do it. Any help would be greatly appreciated!
PS- I'm not interested in forcing the user to log into the site in order to access any content (just thought I should clarify that).
It seems I've found the answer to my own question. The Code of a Ninja seems to have the answer.
You can retrieve an app access_token which is different from a user access_token which requires a permission dialog. You can retrieve the app access_token by redirecting to this URL:
https://graph.facebook.com/oauth/access_token?
client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET&
grant_type=client_credentials
More information can be found under 'app login' section of our authentication docs.
if you use permament access token, make sure you use page, not user access token. If permament user access token, it means only 1 user logs to app, hence your app may be blocked, when too many connections per 1 hour from 1 user will happen. There is warning on FB about that. Additionally you will have low ratings having only 1 user using your app ;)
精彩评论