Prestashop Web 服务 API 不断要求身份验证 [英] Prestashop Web Service API keeps asking for authentication

查看:46
本文介绍了Prestashop Web 服务 API 不断要求身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了这个问题 我从 prestashop 启用了网络服务,如果我编写 URL 直接从 post 方法传递参数,我可以访问它http://underwearstudio.mx/pruebas/api?&ws_key="mykey".

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

但是如果我尝试访问而不将 ws_key 作为参数传递,它会不断要求我进行身份验证.

But If I try to access without passing the ws_key as parameter it keeps asking me to authenticate.

根据我在提示身份验证时阅读的内容,您需要使用 API 密钥作为用户名并保留空白密码,但它只是不断提示身份验证.

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.

我能做什么?

我正在尝试学习本教程.(http://doc.prestashop.com/display/PS15/Chapter+2+-+Discovery+-+Testing+access+to+the+web+service+with++浏览器)

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)

任何帮助将不胜感激

推荐答案

对于像我这样的 googlers:

For googlers such as myself:

从1.6.1.1版本开始,需要在url的末尾添加这个代码[?&ws_key=YourSecretKey],并用这个方法访问webservice,作为username的传递(在文档中说明)不起作用

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;

在第 156 行(在当前版本中),位于

at line 156 (in current version), which is in the

 protected function executeRequest($url, $curl_params = array())

就在初始化 cURL 之前:

and right before the initializing the cURL :

$session = curl_init($url);

这篇关于Prestashop Web 服务 API 不断要求身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆