Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 151 Vote(s) - 3.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Prestashop Web Service API keeps asking for authentication

#1
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

[To see links please register here]

;.

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.(

[To see links please register here]

)


Any help would be greatly appreciated
Reply

#2
From [their documentation](

[To see links please register here]

), it looks like you should be able to put your API key into the URL in place of where a username would go in a regular HTTP request, e.g:

http://[yourapikeyhere]@example.com/api/customers/

This quote from "Testing access to the web service with the browser":

>The shop should prompt you for a username and a password to enter. The ID is the authentication key and there is no password.

... seems to match up with what you said about the username vs password. It looks like these guys are using the API key as the username in a regular HTTP basic authentication sense with no password (otherwise would be `http://user:[email protected]`), which seems to match up with the RESTful URL example they provided above. If basic authentication via your browser isn't working, I'd suggest it's more likely either that your API key is wrong - keep in mind it's highly likely to be case sensitive.

Reply

#3
Just create an .htaccess within webservice folder with:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

Reply

#4
Hello I am also gone through same problem if You want to avoid that authentication of prestashop then you can add the consumer key for that prestashop store in api url such as follows

[To see links please register here]


here while accessing products details you can add consume key to access the products details.
It can be also useful when if you are using prestashop web service apis in other platform.
Thanks
Reply

#5
Since prestashop 1.7.4, they are providing an alternate method.

ie; to access `http://yourstore.com/api/`

it will prompt for username/password.

Enter the key you generated as username and leave password field empty.

This will give you an output like

<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<api shopName="Tureds">
<products xlink:href="https://www.tureds.com/api/products" get="true" put="false" post="true" delete="false" head="false">
<description xlink:href="https://www.tureds.com/api/products" get="true" put="false" post="true" delete="false" head="false"> The products</description>
<schema xlink:href="https://www.tureds.com/api/products?schema=blank" type="blank"/>
<schema xlink:href="https://www.tureds.com/api/products?schema=synopsis" type="synopsis"/>
</products>
</api>
</prestashop>

[![enter image description here][1]][1]

Remember

1. to enable webservice in the backend.
2. No need to regenerate .htaccess file. Regeneration of .htaccess file is for older versions of
prestashop.

[1]:
Reply

#6
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:

[To see links please register here]


to accomplish this using [the webservice library][1] , 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);


[1]:

[To see links please register here]

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through