You are here

function _facebook_pull_accesstoken in Facebook Pull 7.2

Same name and namespace in other branches
  1. 6 facebook_pull.module \_facebook_pull_accesstoken()
  2. 7.3 facebook_pull.module \_facebook_pull_accesstoken()
  3. 7 facebook_pull.module \_facebook_pull_accesstoken()

Get an access token.

1 call to _facebook_pull_accesstoken()
_facebook_pull_feed_cached in ./facebook_pull.module
Pull data from a facebook feed and cache it.

File

./facebook_pull.module, line 295
Default cache time.

Code

function _facebook_pull_accesstoken($app_id, $app_secret) {
  $endpoint = 'https://graph.facebook.com/oauth/access_token?client_id=%s&client_secret=%s&grant_type=client_credentials';
  $fullurl = sprintf($endpoint, $app_id, $app_secret);
  $token = file_get_contents($fullurl);
  if (!$token) {
    $message = 'Failed to fetch data from the Facebook Graph';
    $variables = array();
    watchdog('facebook_pull', $message, $variables, WATCHDOG_WARNING);
    return FALSE;
  }
  return $token;
}