function twitter_oauth_callback_validate in Twitter 6.4
Same name and namespace in other branches
- 6.5 twitter.pages.inc \twitter_oauth_callback_validate()
- 6.3 twitter.pages.inc \twitter_oauth_callback_validate()
File
- ./
twitter.pages.inc, line 371 - Page callbacks for Twitter module.
Code
function twitter_oauth_callback_validate($form, &$form_state) {
module_load_include('inc', 'twitter');
$key = variable_get('twitter_consumer_key', '');
$secret = variable_get('twitter_consumer_secret', '');
$form_state['twitter_oauth'] = $_SESSION['twitter_oauth'];
unset($_SESSION['twitter_oauth']);
$token = $form_state['twitter_oauth']['token'];
if (!is_array($token) || !$key || !$secret) {
form_set_error('oauth_token', t('Invalid Twitter OAuth request'));
}
if ($token['oauth_token'] != $form_state['values']['oauth_token']) {
form_set_error('oauth_token', t('Invalid OAuth token.'));
}
$twitter = new Twitter6($key, $secret, $token['oauth_token'], $token['oauth_token_secret']);
$response = $twitter
->get_access_token();
$form_state['twitter_oauth']['response'] = $response;
}