Prestashop Web Service API keeps asking for authentication
api, authentication, get, php, prestashop
Solution
For googlers such as myself:
Since version, 1.6.1.1, one need to add this code [`?&ws_key=YourSecretKey`] at the end of the url and access the webservice with this method, as the passing as username (stated in the docs) does not work
http://[YourPrestaShopUrl]/api?&ws_key=YourSecretKey
eg: http://192.168.1.148/api/products?limit=5&ws_key=EUQ1J6NT1KVJ1S9SYGRCLGQE8IJU66DA
to accomplish this using the webservice library , you may add this line :
$url .= '&ws_key=' . $this->key;
at line 156 (in current version), which is in the
protected function executeRequest($url, $curl_params = array())
and right before the initializing the cURL :
$session = curl_init($url);
Problem
I am having this problem I enabled the webservice from prestashop and I can access it if I write the URL directly passing the parameter from post method http://underwearstudio.mx/pruebas/api?&ws_key="mykey". But If I try to access without passing the ws_key as parameter it keeps asking me to authenticate. From what I read when authentication is prompted you need to use the API key as username and leave the blank password, but it just keeps prompting the authentication. What can I do? I was trying to follow this tutorial.(http://doc.prestashop.com/display/PS15/Chapter+2+-+Discovery+-+Testing+access+to+the+web+service+with+the+browser) Any help would be greatly appreciated