function google_analytics_counter_oauth_callback in Google Analytics Counter 7.2
Page callback - Provided for Google to call back during the OAuth process.
1 string reference to 'google_analytics_counter_oauth_callback'
- google_analytics_counter_menu in ./
google_analytics_counter.module - Menu for this module
File
- ./
google_analytics_counter_auth.inc, line 177 - Provides the GAFeed object type and associated methods.
Code
function google_analytics_counter_oauth_callback() {
$key = variable_get('google_analytics_counter_consumer_key', 'anonymous');
$secret = variable_get('google_analytics_counter_consumer_secret', 'anonymous');
$session_data = $_SESSION['google_analytics_counter_oauth'];
unset($_SESSION['google_analytics_counter_oauth']);
$token = $session_data['token'];
if (!is_array($token) || !$key || !$secret) {
drupal_set_message(t('Invalid Google Analytics OAuth request'), 'error');
return ' ';
}
if ($token['oauth_token'] != $_GET['oauth_token']) {
drupal_set_message(t('Invalid OAuth token.'), 'error');
return ' ';
}
module_load_include('inc', 'google_analytics_counter', 'GAFeed.lib');
$GAFeed = new GAFeed($key, $secret, $token['oauth_token'], $token['oauth_token_secret']);
/* Google required the verifier */
$GAFeed
->setVerifier($_GET['oauth_verifier']);
$response = $GAFeed
->getAccessToken();
variable_set('google_analytics_counter_oauth_token', $response['oauth_token']);
variable_set('google_analytics_counter_oauth_token_secret', $response['oauth_token_secret']);
drupal_goto('admin/config/system/google_analytics_counter/authentication');
}