cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2 Rest api

Magento 2 Rest api

Hi i am trying to oauth in magento 2 via integration but always getting the following response :

Array
(
    [oauth_problem] => The signature is invalid. Verify and try again.
)

I am using following code to generate signature


$request_headers = [
"oauth_callback"=> urlencode(route('magento',['param'=>'getkeys'])),
"oauth_consumer_key" => urlencode("rgwwj37w5n0**********601inp"),
"oauth_nonce" => urlencode(md5(rand())),
"oauth_signature_method"=>urlencode("HMAC-SHA1"),
"oauth_timestamp" => urlencode(time()),
"oauth_version" =>urlencode("1.0"),

];
$key = "xv2dhhz7**********u8z8q21wrpo&";
$request_headers["oauth_signature"] = $key;
$singature = urlencode(base64_encode(hash_hmac('sha1',urlencode("POST&").http_build_query($request_headers),$key,true)));


Thanks in advance.

 

2 REPLIES 2

Re: Magento 2 Rest api

Hello @tarun_abc 

Are you using older version of Magento?

Check this link.

https://magento.stackexchange.com/questions/24103/invalid-signature-add-a-product-using-magento-rest...

 

As you didn't mention error code here is the list to get idea about

https://devdocs.magento.com/guides/v2.3/get-started/authentication/oauth-errors.html

 

 

Was my answer helpful? You can accept it as a solution.
175+ Professional Extensions for M1 & M2
Need a developer?Just visit Contact Us Now

Re: Magento 2 Rest api

@theMageComp 
I am using Magento 2.3 and getting only this as a response
Endpoint - oauth/token/request

Array
(
    [oauth_problem] => The signature is invalid. Verify and try again.
)