You are here

function TwitterOAuth::getXAuthToken in Tweet Feed 7.2

Same name and namespace in other branches
  1. 6 inc/twitter-oauth.inc \TwitterOAuth::getXAuthToken()
  2. 7.3 inc/twitter-oauth.inc \TwitterOAuth::getXAuthToken()
  3. 7 inc/twitter-oauth.inc \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

inc/twitter-oauth.inc, line 127

Class

TwitterOAuth
Twitter OAuth class

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;
}