You are here

function feeds_oauth_authenticate2 in Feeds OAuth 7

Menu callback to start authenticating OAuth 2.

1 string reference to 'feeds_oauth_authenticate2'
feeds_oauth_menu in ./feeds_oauth.module
Implements hook_menu().

File

./feeds_oauth.module, line 203
The module file.

Code

function feeds_oauth_authenticate2($id) {
  $fetcher = feeds_importer($id)->fetcher;
  $config = $fetcher
    ->getConfig();
  $query = array(
    'client_id' => $config['consumer_key'],
    'redirect_uri' => url('feeds/oauth2/callback/' . $id, array(
      'absolute' => TRUE,
    )),
    'scope' => $config['scope'],
    'response_type' => 'code',
    'access_type' => 'offline',
  );
  $_SESSION['feeds'] = array(
    'destination' => $_SERVER['HTTP_REFERER'],
  );
  drupal_goto(url($config['authorize_url'], array(
    'absolute' => TRUE,
    'query' => $query,
  )));
}