Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过Curl和基于令牌的身份验证对Magento Rest API进行身份验证失败_Api_Magento_Curl - Fatal编程技术网

通过Curl和基于令牌的身份验证对Magento Rest API进行身份验证失败

通过Curl和基于令牌的身份验证对Magento Rest API进行身份验证失败,api,magento,curl,Api,Magento,Curl,因为我只想连接到我自己的站点,所以我应该能够忽略oAuth,并按照以下步骤进行基于令牌的身份验证: 我的卷曲请求看起来完全像: curl -X POST "https://magento.host/index.php/rest/V1/integration/admin/token" \ -H "Content-Type:application/json" \ -d '{"username":"test@example.com", "password":"123123q"}'

因为我只想连接到我自己的站点,所以我应该能够忽略oAuth,并按照以下步骤进行基于令牌的身份验证:

我的卷曲请求看起来完全像:

curl -X POST "https://magento.host/index.php/rest/V1/integration/admin/token" \
     -H "Content-Type:application/json" \
     -d '{"username":"test@example.com", "password":"123123q"}'
我得到的回应是我自己网站上的一个HTML页面,上面基本上写着“找不到页面”,很明显我要去的是正确的域,但URL中的其他内容似乎不正确。有什么想法吗


我使用了错误的URL吗

在1.9版中,需要创建来宾端点。那么您就不需要使用oAuth了。您可以在这里看到如何使用它:

一个使用REST的身份验证系统,这样您就不需要实际跟踪或管理系统中的用户。这是通过使用HTTP方法POST、GET、PUT和DELETE来完成的。我们采用这4种方法,并从数据库交互的角度考虑它们,即创建、读取、更新和删除

在Magento 1.x版本上,没有直接的方法使用基于REST令牌的身份验证。您需要自己编写此功能。我已经使用RESTAPI编写了此功能,您也可以按照本文了解更多详细信息


您正在使用Magento 2.0吗?这是一个关于v2Good问题的文档。我怎么知道呢?显然我没有使用1.9.0版。谢谢你的澄清。只是想知道是否有类似的方式使用版本1,而我不需要使用oAuth.Thank。Guest只能访问公共资源,而我需要它来处理客户和订单之类的事情。