You are here

function TwitterOAuth::getXAuthToken in jQuery social stream 8.2

Same name and namespace in other branches
  1. 8 src/Twitter/TwitterOAuth.php \Drupal\jquery_social_stream\Twitter\TwitterOAuth::getXAuthToken()

One time exchange of username and password for access token and secret.

@returns array("oauth_token" => "the-access-token", "oauth_token_secret" => "the-access-secret", "user_id" => "9436992", "screen_name" => "abraham", "x_auth_expires" => "0")

File

src/Twitter/TwitterOAuth.php, line 138

Class

TwitterOAuth
Twitter OAuth class

Namespace

Drupal\jquery_social_stream\Twitter

Code

function getXAuthToken($username, $password) {
  $parameters = array();
  $parameters['x_auth_username'] = $username;
  $parameters['x_auth_password'] = $password;
  $parameters['x_auth_mode'] = 'client_auth';
  $request = $this
    ->oAuthRequest($this
    ->accessTokenURL(), 'POST', $parameters);
  $token = OAuthUtil::parse_parameters($request);
  $this->token = new OAuthConsumer($token['oauth_token'], $token['oauth_token_secret']);
  return $token;
}