how to get access token without any login?

2019-08-01 03:24发布

问题:

In my iPhone app I want to read news feed from public Facebook page but I don't want in the beginning that the user has log in facebook to see wall of page. I try to pass access_token (in url to graph api) but this access token expire.

Thank you in advance

Javier

回答1:

You may use your application access token for this which may be one of:

  • YOUR_APP_ID|YOUR_APP_SECRET
  • Application Access Token received from https://graph.facebook.com/oauth/access_token? client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET& grant_type=client_credentials

This access_token allow you to get any public content available via API which require access_token

Update:
Using iOS SDK this may looks like:

[facebook requestWithGraphPath:@"/oauth/access_token?client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET&
 grant_type=client_credentials" andDelegate:self];