I am trying to make a function that generate HMAC-SHA1 signature but getting an error (invalid_signature)
My source code is
public function generateSignature($request, $timestamp, $nonce, $signatureMethod, $version, $consumerKey, $consumerSecret)
{
$base = $request['method'] . "&" . rawurlencode($request['url']) . "&"
. rawurlencode("oauth_consumer_key=" . rawurlencode($consumerKey)
. "&oauth_nonce=" . rawurlencode($nonce)
. "&oauth_signature_method=" . rawurlencode($signatureMethod)
. "&oauth_timestamp=" . rawurlencode($timestamp)
. "&oauth_version=" . rawurlencode($version));
$key = rawurlencode($consumerSecret);
$signature = base64_encode(hash_hmac('sha1', $base, $key, true));
return $signature;
}
it works perfectly on postman with the values used in the function but not by using this function.
I am trying to generate signature for E-Trade Api
https://api.etrade.com/oauth/request_token
Thanks in advance.