Permalink
Browse files

Standardize OAuth to use access_token and not token

  • Loading branch information...
1 parent 2082b65 commit fbfa8eeffe25e1ef8170f51c89a24f2bf5408baf @crynobone crynobone committed Nov 23, 2011
View
6 classes/provider.php
@@ -190,7 +190,7 @@ public function authorize_url(Token_Request $token, array $params = NULL)
{
// Create a new GET request for a request token with the required parameters
$request = Request::forge('authorize', 'GET', $this->url_authorize(), array(
- 'oauth_token' => $token->token,
+ 'oauth_token' => $token->access_token,
));
if ($params)
@@ -217,7 +217,7 @@ public function access_token(Consumer $consumer, Token_Request $token, array $pa
// Create a new GET request for a request token with the required parameters
$request = Request::forge('access', 'GET', $this->url_access_token(), array(
'oauth_consumer_key' => $consumer->key,
- 'oauth_token' => $token->token,
+ 'oauth_token' => $token->access_token,
'oauth_verifier' => $token->verifier,
));
@@ -235,7 +235,7 @@ public function access_token(Consumer $consumer, Token_Request $token, array $pa
// Store this token somewhere useful
return Token::forge('access', array(
- 'token' => $response->param('oauth_token'),
+ 'access_token' => $response->param('oauth_token'),
'secret' => $response->param('oauth_token_secret'),
'uid' => $response->param($this->uid_key) ?: \Input::get_post($this->uid_key),
));
View
2 classes/provider/dropbox.php
@@ -42,7 +42,7 @@ public function get_user_info(Consumer $consumer, Token $token)
// Create a new GET request with the required parameters
$request = Request::forge('resource', 'GET', 'https://api.dropbox.com/0/account/info', array(
'oauth_consumer_key' => $consumer->key,
- 'oauth_token' => $token->token,
+ 'oauth_token' => $token->access_token,
));
// Sign the request using the consumer and token
View
2 classes/provider/flickr.php
@@ -42,7 +42,7 @@ public function get_user_info(Consumer $consumer, Token $token)
// Create a new GET request with the required parameters
$request = Request::forge('resource', 'GET', 'http://api.flickr.com/services/rest', array(
'oauth_consumer_key' => $consumer->key,
- 'oauth_token' => $token->token,
+ 'oauth_token' => $token->access_token,
'nojsoncallback' => 1,
'format' => 'json',
'method' => 'flickr.test.login',
View
2 classes/provider/google.php
@@ -47,7 +47,7 @@ public function get_user_info(Consumer $consumer, Token $token)
// Create a new GET request with the required parameters
$request = Request::forge('resource', 'GET', 'https://www.google.com/m8/feeds/contacts/default/full?max-results=1&alt=json', array(
'oauth_consumer_key' => $consumer->key,
- 'oauth_token' => $token->token,
+ 'oauth_token' => $token->access_token,
));
// Sign the request using the consumer and token
View
2 classes/provider/linkedin.php
@@ -43,7 +43,7 @@ public function get_user_info(Consumer $consumer, Token $token)
$url = 'https://api.linkedin.com/v1/people/~:(id,first-name,last-name,headline,member-url-resources,picture-url,location,public-profile-url)';
$request = Request::forge('resource', 'GET', $url, array(
'oauth_consumer_key' => $consumer->key,
- 'oauth_token' => $token->token,
+ 'oauth_token' => $token->access_token,
));
// Sign the request using the consumer and token
View
2 classes/provider/twitter.php
@@ -44,7 +44,7 @@ public function get_user_info(Consumer $consumer, Token $token)
// Create a new GET request with the required parameters
$request = Request::forge('resource', 'GET', 'http://api.twitter.com/1/users/lookup.json', array(
'oauth_consumer_key' => $consumer->key,
- 'oauth_token' => $token->token,
+ 'oauth_token' => $token->access_token,
'user_id' => $token->uid,
));
View
10 classes/token.php
@@ -38,7 +38,7 @@ public static function forge($name, array $options = NULL)
/**
* @var string token key
*/
- protected $token;
+ protected $access_token;
/**
* @var string token secret
@@ -58,17 +58,17 @@ public static function forge($name, array $options = NULL)
*/
public function __construct(array $options = NULL)
{
- if ( ! isset($options['token']))
+ if ( ! isset($options['access_token']))
{
- throw new \FuelException('Required option not passed: token');
+ throw new \FuelException('Required option not passed: access_token');
}
if ( ! isset($options['secret']))
{
throw new \FuelException('Required option not passed: secret');
}
- $this->access_token = $options['token'];
+ $this->access_token = $options['access_token'];
$this->secret = $options['secret'];
@@ -111,7 +111,7 @@ public function __isset($key)
*/
public function __toString()
{
- return (string) $this->token;
+ return (string) $this->access_token;
}
} // End Token

0 comments on commit fbfa8ee

Please sign in to comment.