You are here

function twitter_account_oauth_validate in Twitter 6.3

Same name and namespace in other branches
  1. 7.3 twitter.pages.inc \twitter_account_oauth_validate()
1 string reference to 'twitter_account_oauth_validate'
twitter_account_form in ./twitter.pages.inc
Form to add a Twitter account

File

./twitter.pages.inc, line 314

Code

function twitter_account_oauth_validate($form, &$form_state) {
  module_load_include('php', 'oauth_common', 'lib/OAuth');
  $key = variable_get('twitter_consumer_key', '');
  $secret = variable_get('twitter_consumer_secret', '');
  $twitter = new TwitterOAuth($key, $secret);
  $token = $twitter
    ->get_request_token();
  $_SESSION['twitter_oauth']['account'] = user_load($form['uid']['#value']);
  $_SESSION['twitter_oauth']['token'] = $token;
  $_SESSION['twitter_oauth']['destination'] = $_GET['q'];
  drupal_goto($twitter
    ->get_authorize_url($token));
}