Back to Top

How we can send the webservice key of PrestaShop in authorization header instead of URL

Updated 12 September 2024

In this blog, we will learn how to send webservice key in the authorization header instead of the URL.

Sometimes we need that we do not want to show webservice key in the API URL & Prestashop sends ws_key with its value in the URL. Check this:

API with ws_key

If we want to remove this from the URL, we need to send this in the authorization header as Basic Auth. Please check the below image.

API with authorization header

Also, there is another option to manage webservice key privacy. You can set this ws_key directly in the code to manage APIs.

For this, You need to save webservice key in a configuration key & then you can directly access this ws_key.

Searching for an experienced
Prestashop Company ?
Find out More
$wsKey = Configuration::get('YOUR_WEBSERVICE_KEY');

You can directly set ws_key in webservice dispatcher.php

$wsKey = Configuration::get('YOUR_WEBSERVICE_KEY');
$_GET['ws_key'] = $wsKey;

Here is the file path: YOUR_PRESTASHOP_ROOT/webservice/dispatcher.php

Now you can check there is no authentication set for webservice request & no ws_key pass in the API URL but the result is still present.

API with no webservice key

That’s all about this blog. Hope it will help you.

If you are facing any issues or have any doubts about the above process, please feel free to contact us through the comment section.

Also, you can explore our PrestaShop Development Services and a large range of quality PrestaShop Modules.

For any doubt contact us at [email protected]

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Back to Top

Message Sent!

If you have more details or questions, you can reply to the received confirmation email.

Back to Home