1

I am working with Magento Rest API for the first time, i went through the tutorials of Rest API on http://www.magentocommerce.com/api/rest and tried one example to fetch product through API:

$callbackUrl = "http://localhost/wineshop/products.php";
$temporaryCredentialsRequestUrl = "http://localhost/wineshop/oauth/initiate?     oauth_callback=" . urlencode($callbackUrl);
$adminAuthorizationUrl = 'http://localhost/wineshop/admin/oauth_authorize';
$accessTokenRequestUrl = 'http://localhost/wineshop/oauth/token';
$apiUrl = 'http://localhost/wineshop/api/rest';
$consumerKey = 'u48p1x9gzrg7r82c94woa5z7g805uw0i';
$consumerSecret = '96ydrk8s89xxath8h5z71vcl5abfq0zg';

session_start();
if (!isset($_GET['oauth_token']) && isset($_SESSION['state']) && $_SESSION['state'] == 1) {
$_SESSION['state'] = 0;
}
try {
$authType = ($_SESSION['state'] == 2) ? OAUTH_AUTH_TYPE_AUTHORIZATION : OAUTH_AUTH_TYPE_URI;
$oauthClient = new OAuth($consumerKey, $consumerSecret,  OAUTH_SIG_METHOD_HMACSHA1, $authType);
$oauthClient->enableDebug();

I've also installed the latest version of OAUTH and it also shows in my WampServer PHP Extensions but it doesn't show in phpinfo(). I coped the php_oauth.dll file into ..\www\bin\php\ext and i also edited php.ini and entered extension=php_oauth.dll but on running the products.php it shows me the

Fatal error: Class 'OAuth' not found in P:\wamp\www\products.php on line 19
And i also want to know that how to request for the token i've got key and secret after entering new consumer in Magento Admin Panel. But i don't know how to get Access Token & Access Token Secret that we enter in RESTClient

Please Help, Thanks in advance

5
  • This appears to be an issue loading the library. WAMP can be a... fickle thing. Are you use you edited the correct php.ini? If it doesn't show in your phpinfo something is wrong, either your DLL is in the wrong place, or the php.ini is the wrong one. Jul 19, 2013 at 15:47
  • I edited the php.ini in wamp\bin\php\php5.4.3 and copied the DLL in wamp\bin\php\php5.4.3\ext Jul 20, 2013 at 6:06
  • Just asking to be sure, but did you restart apache after modifying your php.ini file?
    – Dan
    Jul 20, 2013 at 10:34
  • Yes i did, i restarted my WAMP Server after it. Jul 20, 2013 at 13:06
  • Instead of new OAuth(..., try using new \OAuth(... (add a backslash before the class name)
    – Dan
    Aug 2, 2013 at 15:48

1 Answer 1

1

I can partially answer your question.

Access Token and Access Token secret are provided by the authentication server upon request and they validate the further requests.

Just a matter of chance, you can check if oAuth works for you by following this link

2
  • Yes i followed all the steps on given link but the thing is i'm having this oAuth error so i can't go ahead and without running this file i will not be able to get Access Token or Access Token Secret. Jul 20, 2013 at 13:10
  • Can you tell the exact error? In case I might know the solution.... Oct 24, 2013 at 7:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.