function feeds_oauth2_authenticate in Feeds OAuth 6
1 string reference to 'feeds_oauth2_authenticate'
- feeds_oauth_menu in ./
feeds_oauth.module - Implementation of hook_menu().
File
- ./
feeds_oauth.module, line 93
Code
function feeds_oauth2_authenticate($id) {
require_once drupal_get_path('module', 'feeds_oauth') . '/php-proauth-read-only/lib/oauth/OAuth2Client.php';
$fetcher = feeds_importer($id)->fetcher;
$config = $fetcher
->getConfig();
$oauth = new OAuth2CurlClient();
$oauth
->setEndpoints($config['authorize_url'], $config['access_token_url']);
$oauth
->setClientId($config['consumer_key'], $config['consumer_secret']);
$obt = $oauth
->getAccessTokenObtainer('web_server');
$obt
->setRedirectUrl(url("feeds/oauth2/callback/{$config['site_id']}/{$id}", array(
'absolute' => TRUE,
)));
$params = array();
if (!empty($config['scope'])) {
$params['scope'] = preg_replace('/\\r?\\n/', ',', $config['scope']);
}
$obt
->webFlowRedirect($params);
}