You are here

function TwittersOAuth::getXAuthToken in jQuery social stream 7

Same name and namespace in other branches
  1. 7.2 jquery_social_stream.js.inc \TwittersOAuth::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

./jquery_social_stream.js.inc, line 210
JS callbacks.

Class

TwittersOAuth
Twitter sOAuth 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 = sOAuthUtil::parse_parameters($request);
  $this->token = new sOAuthConsumer($token['oauth_token'], $token['oauth_token_secret']);
  return $token;
}