Not able to get OAuth token for Magento Rest Clien

2019-08-01 07:33发布

问题:

I am using Magento version 1.9.1.0 and trying to use Magento Rest APIs using OAuth Integration. I have consumer key and consumer secret. Now want to get OAuth token for Rest APIs usage. I have followed http://www.magentocommerce.com/api/rest/authentication/oauth_authentication.html

In this , we needed oauth_signature and timestamp which we doesn't get when we create consumer on admin panel . Now how can we get OAuth token with only consumer key and consumer secret ?

回答1:

I think you should follow Inchoo blog http://inchoo.net/magento/consuming-magento-rest-zend_oauth_consumer/. Hope you will get some idea.



回答2:

The following parameters are required to oauth initiate process :

realm="",
 oauth_version="1.0",//oauth version
 oauth_signature_method="PLAINTEXT",
 oauth_nonce="oklThLFvQkxNUpf",//a random unique value
 oauth_timestamp="1426745444", //current time stamp
 oauth_consumer_key="37d05fa37aea5513d4cda24c0b1f3e00",//get from admin 'key'
 oauth_signature="a183969724b3068b7b0d70e7ce9d0f09%26",//a random unique string
oauth_callback="http%3A%2F%2Flocalhost%3A8888" // your call back method

The initiate url will be like => http://yourdomain/oauth/initiate

I also attached two snap for your help.



回答3:

please check that .htaccess file rewrite

RewriteRule ^api/rest api.php?type=rest [QSA,L]

takes effect.

Check you use Apache (not nginx or other Webserver that doesn't support .htaccess)