Required parameters

return [
		'oauth_consumer_key'     => $this->getCredential('oauth_consumer_key'),
		'oauth_nonce'            => $this->getNonce(),
		'oauth_signature_method' => self::SIGNATURE_METHOD,
		'oauth_timestamp'        => time(),
		'oauth_version'          => self::VERSION,
		];

If you have oauth_callback it would be included

$parameters = array_merge(['oauth_callback' => $callback], $this->getOauthParameters());

Then now you are ready

  • ParametersString is combined by encode key & value with “=” at middle.
  • Base string is combined {METHOD}&encode{URI}&encode{ParametersString}
  • Key is encode($consumerSecret) ‘&’ encode(TokenSecret) ( if exists )
		ksort($parameters);

		$parametersString = [];

		foreach ($parameters as $key => $value)
		{
			$parametersString[] = $this->encode($key) . '=' . $this->encode($value);
		}

		$baseSignature = strtoupper($method)
			. '&' . $this->encode($uri)
			. '&' . $this->encode(implode('&', $parametersString));

		return $this->encode(base64_encode(hash_hmac('SHA1', $baseSignature, $this->getKey(), true)));


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Blog at WordPress.com.

Up ↑

%d bloggers like this: