* The first PHP Library to support OAuth for Tumblr's REST API. (Originally for Twitter, modified for Tumblr by Lucas)
*/
+use Friendica\Security\OAuth1\OAuthConsumer;
+use Friendica\Security\OAuth1\OAuthRequest;
+use Friendica\Security\OAuth1\Signature\OAuthSignatureMethod_HMAC_SHA1;
+use Friendica\Security\OAuth1\OAuthToken;
+use Friendica\Security\OAuth1\OAuthUtil;
+
/**
* Tumblr OAuth class
*/
private $token;
/** @var OAuthConsumer */
private $consumer;
- /** @var OAuthSignatureMethod_HMAC_SHA1 */
+ /** @var \Friendica\Security\OAuth1\Signature\OAuthSignatureMethod_HMAC_SHA1 */
private $sha1_method;
/**
$this->sha1_method = new OAuthSignatureMethod_HMAC_SHA1();
$this->consumer = new OAuthConsumer($consumer_key, $consumer_secret);
if (!empty($oauth_token) && !empty($oauth_token_secret)) {
- $this->token = new OAuthConsumer($oauth_token, $oauth_token_secret);
+ $this->token = new OAuthToken($oauth_token, $oauth_token_secret);
} else {
$this->token = null;
}
$request = $this->oAuthRequest($this->requestTokenURL(), 'GET', $parameters);
$token = OAuthUtil::parse_parameters($request);
- $this->token = new OAuthConsumer($token['oauth_token'], $token['oauth_token_secret']);
+ $this->token = new OAuthToken($token['oauth_token'], $token['oauth_token_secret']);
return $token;
}
$request = $this->oAuthRequest($this->accessTokenURL(), 'GET', $parameters);
$token = OAuthUtil::parse_parameters($request);
- $this->token = new OAuthConsumer($token['oauth_token'], $token['oauth_token_secret']);
+ $this->token = new OAuthToken($token['oauth_token'], $token['oauth_token_secret']);
return $token;
}
$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']);
+ $this->token = new OAuthToken($token['oauth_token'], $token['oauth_token_secret']);
return $token;
}
$url = "{$this->host}{$url}";
}
- $request = OAuthRequest::from_consumer_and_token($this->consumer, $this->token, $method, $url, $parameters);
+ $request = OAuthRequest::from_consumer_and_token($this->consumer, $method, $url, $parameters, $this->token);
$request->sign_request($this->sha1_method, $this->consumer, $this->token);
switch ($method) {
case 'GET':
/**
* Make an HTTP request
*
- *
* @param string $url
* @param string $method
* @param mixed $postfields