facebook - How to retrieve User Token with server side app integration -
the objective extremely simple, yet there no examples on how retrieve user token associated running app.
my objective pull public facebook page (business page finish open access) app have created in facebook mere created app id , secret can have php perform request info , iterate on homepage. simple, yet documentation on site deals facebook logins have no intention of doing. want feeds public business page on site.
this think facebook goes horribly wrong. here code far queries generates empty info set:
$app_id = "app_id"; $app_secret = "app_secret"; $app_token_url = "https://graph.facebook.com/oauth/access_token?" . "client_id=" . $app_id . "&client_secret=" . $app_secret . "&grant_type=client_credentials"; $response = file_get_contents($app_token_url); $params = null; parse_str($response, $params); $graph_url = "https://graph.facebook.com/202978003068170/feed?access_token=".$params['access_token']; $app_details = json_decode(file_get_contents($graph_url), true); echo '<pre>'; var_dump($app_details); echo '<pre>';
now allow clarify actual access_token
value because facebook vague ambiguous this. there 2 types of access tokens , app have created has both types if logged in , working on app can see here: https://developers.facebook.com/tools/access_token/
the major problem access_token
value oauth returns code above "app token" has no problem querying user profile info (which kinda scary) returns blank info when seek query public business page {"data":[]}
have enabled permissions for. after week of trying out different methods , slamming head on desk , finding partial salvation through 3rd party sources of info did figure out difference between these two.
i have ran across post on here said have 2nd oauth query pull app's "user token" (which have tested user token associated app token token debugger in fbook , works) facebook query consist.
please help. should not difficult, not wanting users login site fbook. want display business events, feeds , pictures on business website.
thank you
facebook facebook-graph-api
No comments:
Post a Comment