Skip to content
This repository has been archived by the owner on Jul 15, 2019. It is now read-only.

Commit

Permalink
fixed getAccessToken to use oauth_session_handle key if available
Browse files Browse the repository at this point in the history
  • Loading branch information
zagraves committed Sep 22, 2009
1 parent dddb3e9 commit 5a9fb3b
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions lib/Yahoo/YahooOAuthApplication.class.php
Expand Up @@ -111,10 +111,21 @@ public function getRequestToken($callback = "oob")

public function getAuthorizationUrl($oauth_request_token)
{
$oauth_request = OAuthRequest::from_consumer_and_token($this->consumer, $oauth_request_token, 'GET', YahooOAuthClient::AUTHORIZATION_API_URL);
$oauth_request->sign_request($this->signature_method_hmac_sha1, $this->consumer, $oauth_request_token);

return $oauth_request->to_url();
// $oauth_request = OAuthRequest::from_consumer_and_token($this->consumer, $oauth_request_token, 'GET', YahooOAuthClient::AUTHORIZATION_API_URL);
// $oauth_request->sign_request($this->signature_method_hmac_sha1, $this->consumer, $oauth_request_token);

// return $oauth_request->to_url();

if($oauth_request_token->request_auth_url)
{
$auth_url = $oauth_request_token->request_auth_url;
}
else
{
$auth_url = sprintf("%s?oauth_token=%s", YahooOAuthClient::AUTHORIZATION_API_URL, $oauth_request_token->key);
}

return $auth_url;
}

public function getAccessToken($oauth_request_token, $verifier = null)
Expand All @@ -128,6 +139,11 @@ public function getAccessToken($oauth_request_token, $verifier = null)
$parameters = array('oauth_verifier' => $verifier);
}

if($oauth_request_token->session_handle)
{
$parameters["oauth_session_handle"] = $oauth_request_token->session_handle;
}

$oauth_request = OAuthRequest::from_consumer_and_token($this->consumer, $oauth_request_token, 'GET', YahooOAuthClient::ACCESS_TOKEN_API_URL, $parameters);
$oauth_request->sign_request($this->signature_method_hmac_sha1, $this->consumer, $oauth_request_token);
$this->token = $this->client->fetch_access_token($oauth_request);
Expand Down

0 comments on commit 5a9fb3b

Please sign in to comment.