Is it possible to (temporarily?) disable the requirement for oAuth in Magento and still retrieve product data etc. through the REST API?
So basically be able to issue GET requests over HTTP without using oAuth and still have data returned?
Thanks,
Temporary disable the oAuth:
Have a look at the Mage_Api2_Model_Auth model under app/code/core/Mage/Api2/Model/Auth.php
public function authenticate(Mage_Api2_Model_Request $request)
{
...
$authAdapter = Mage::getModel('api2/auth_adapter');
$userParamsObj = $authAdapter->getUserParams($request);
// Added code:
$userParamsObj->type = 'admin';
$userParamsObj->id = 1;
}
I have had to struggle with the Oauth implementation on Magento recently and I managed to get my testing done by disabling the Oauth mechanism as follows...
If you simply enter the following URL Magento assumes you are connecting as a Guest. http://www.yourmagentopath.com/api/rest/products?limit=2 (for example)
Currently by default the Guest role has no permissions to view any information. This returns a 403 (access denied).
So login to Magento Admin, Goto System->Web Services->REST - Roles Select Guest from the list and click the boxes to allow the guest account to view details.
Save the details and refresh the page from the link provided above. You should now see 2 products displayed in XML format.
To see all products simply remove the limit...
It is possible to add a custom REST authentication adapter in Magento. For example, you can use HMAC method for securing communication between client and server.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With