Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Standardize OAuth to use access_token and not token

  • Loading branch information...
commit fbfa8eeffe25e1ef8170f51c89a24f2bf5408baf 1 parent 2082b65
Mior Muhammad Zaki crynobone authored
6 classes/provider.php
@@ -190,7 +190,7 @@ public function authorize_url(Token_Request $token, array $params = NULL)
190 190 {
191 191 // Create a new GET request for a request token with the required parameters
192 192 $request = Request::forge('authorize', 'GET', $this->url_authorize(), array(
193   - 'oauth_token' => $token->token,
  193 + 'oauth_token' => $token->access_token,
194 194 ));
195 195
196 196 if ($params)
@@ -217,7 +217,7 @@ public function access_token(Consumer $consumer, Token_Request $token, array $pa
217 217 // Create a new GET request for a request token with the required parameters
218 218 $request = Request::forge('access', 'GET', $this->url_access_token(), array(
219 219 'oauth_consumer_key' => $consumer->key,
220   - 'oauth_token' => $token->token,
  220 + 'oauth_token' => $token->access_token,
221 221 'oauth_verifier' => $token->verifier,
222 222 ));
223 223
@@ -235,7 +235,7 @@ public function access_token(Consumer $consumer, Token_Request $token, array $pa
235 235
236 236 // Store this token somewhere useful
237 237 return Token::forge('access', array(
238   - 'token' => $response->param('oauth_token'),
  238 + 'access_token' => $response->param('oauth_token'),
239 239 'secret' => $response->param('oauth_token_secret'),
240 240 'uid' => $response->param($this->uid_key) ?: \Input::get_post($this->uid_key),
241 241 ));
2  classes/provider/dropbox.php
@@ -42,7 +42,7 @@ public function get_user_info(Consumer $consumer, Token $token)
42 42 // Create a new GET request with the required parameters
43 43 $request = Request::forge('resource', 'GET', 'https://api.dropbox.com/0/account/info', array(
44 44 'oauth_consumer_key' => $consumer->key,
45   - 'oauth_token' => $token->token,
  45 + 'oauth_token' => $token->access_token,
46 46 ));
47 47
48 48 // Sign the request using the consumer and token
2  classes/provider/flickr.php
@@ -42,7 +42,7 @@ public function get_user_info(Consumer $consumer, Token $token)
42 42 // Create a new GET request with the required parameters
43 43 $request = Request::forge('resource', 'GET', 'http://api.flickr.com/services/rest', array(
44 44 'oauth_consumer_key' => $consumer->key,
45   - 'oauth_token' => $token->token,
  45 + 'oauth_token' => $token->access_token,
46 46 'nojsoncallback' => 1,
47 47 'format' => 'json',
48 48 'method' => 'flickr.test.login',
2  classes/provider/google.php
@@ -47,7 +47,7 @@ public function get_user_info(Consumer $consumer, Token $token)
47 47 // Create a new GET request with the required parameters
48 48 $request = Request::forge('resource', 'GET', 'https://www.google.com/m8/feeds/contacts/default/full?max-results=1&alt=json', array(
49 49 'oauth_consumer_key' => $consumer->key,
50   - 'oauth_token' => $token->token,
  50 + 'oauth_token' => $token->access_token,
51 51 ));
52 52
53 53 // Sign the request using the consumer and token
2  classes/provider/linkedin.php
@@ -43,7 +43,7 @@ public function get_user_info(Consumer $consumer, Token $token)
43 43 $url = 'https://api.linkedin.com/v1/people/~:(id,first-name,last-name,headline,member-url-resources,picture-url,location,public-profile-url)';
44 44 $request = Request::forge('resource', 'GET', $url, array(
45 45 'oauth_consumer_key' => $consumer->key,
46   - 'oauth_token' => $token->token,
  46 + 'oauth_token' => $token->access_token,
47 47 ));
48 48
49 49 // Sign the request using the consumer and token
2  classes/provider/twitter.php
@@ -44,7 +44,7 @@ public function get_user_info(Consumer $consumer, Token $token)
44 44 // Create a new GET request with the required parameters
45 45 $request = Request::forge('resource', 'GET', 'http://api.twitter.com/1/users/lookup.json', array(
46 46 'oauth_consumer_key' => $consumer->key,
47   - 'oauth_token' => $token->token,
  47 + 'oauth_token' => $token->access_token,
48 48 'user_id' => $token->uid,
49 49 ));
50 50
10 classes/token.php
@@ -38,7 +38,7 @@ public static function forge($name, array $options = NULL)
38 38 /**
39 39 * @var string token key
40 40 */
41   - protected $token;
  41 + protected $access_token;
42 42
43 43 /**
44 44 * @var string token secret
@@ -58,9 +58,9 @@ public static function forge($name, array $options = NULL)
58 58 */
59 59 public function __construct(array $options = NULL)
60 60 {
61   - if ( ! isset($options['token']))
  61 + if ( ! isset($options['access_token']))
62 62 {
63   - throw new \FuelException('Required option not passed: token');
  63 + throw new \FuelException('Required option not passed: access_token');
64 64 }
65 65
66 66 if ( ! isset($options['secret']))
@@ -68,7 +68,7 @@ public function __construct(array $options = NULL)
68 68 throw new \FuelException('Required option not passed: secret');
69 69 }
70 70
71   - $this->access_token = $options['token'];
  71 + $this->access_token = $options['access_token'];
72 72
73 73 $this->secret = $options['secret'];
74 74
@@ -111,7 +111,7 @@ public function __isset($key)
111 111 */
112 112 public function __toString()
113 113 {
114   - return (string) $this->token;
  114 + return (string) $this->access_token;
115 115 }
116 116
117 117 } // End Token

0 comments on commit fbfa8ee

Please sign in to comment.
Something went wrong with that request. Please try again.