简体   繁体   English

magento访问被拒绝

[英]magento access denied

I have installed Magento 1.7.0.2 on Ubuntu 12.0.4 server and everything works. 我已经在Ubuntu 12.0.4服务器上安装了Magento 1.7.0.2,并且一切正常。

Testing REST API with an admin role (http://1.2.3.4/magento/api/rest/products) I get this result: 使用管理员角色测试REST API(http://1.2.3.4/magento/api/rest/products)我得到以下结果:

<magento_api>
  <messages>
    <error>
      <data_item>
      <code>403</code>
        <message>Access denied</message>
      </data_item>
    </error>
  </messages>
</magento_api>

I have created an admin role grant all access on all and the token authentication procedure was ok. 我创建了一个管理员角色,授予对所有角色的所有访问权限,并且令牌身份验证过程还可以。

I've tried with magento go service, Bitnami VM and Windows installer but seems that web services are not present (I can see only user/role under Web Services). 我已经尝试过使用magento go服务,Bitnami VM和Windows安装程序,但是似乎不存在Web服务(我只能在Web Services下看到用户/角色)。

Did you know of a magento setup with REST API working? 您知道使用REST API的magento设置吗?

How can I debug this kind of error? 如何调试此类错误? I have tried with different REST client. 我尝试使用其他REST客户端。

Thanks! 谢谢!

Did you set permissions for roles and attributes? 您是否设置了角色和属性的权限? If not check do it first magentocommerce.com/api/rest/permission_settings/ 如果未选中,请先进行magentocommerce.com/api/rest/permission_settings/

I have once tested REST API for magento.. 我曾经为magento测试过REST API。

I following blogs helped me to setup the REST Api 我关注的博客帮助我设置了REST Api

1.first 1.第一

2.second 2.秒

3.third 3.第三

I used RESTClient addon for firefox for testing and be sure that Oauth is enabled at server. 我将RESTClient插件用于Firefox以进行测试,并确保在服务器上启用了Oauth。

Check the below post.This may be helpful to you. 查看以下帖子。这可能对您有所帮助。

Oauth rest api OAuth Rest API

and also 并且

Get product using admin user . 使用admin用户获取产品

Thanks to chanz up there, I found the solution to my own issue. 多亏了chanz,我找到了解决自己问题的方法。

It doesn't seem to accept the OAuth parameters as query string parameters. 它似乎不接受OAuth参数作为查询字符串参数。 I tried sending them as HTTP headers instead and it's going through. 我尝试将它们作为HTTP标头发送,并且正在进行。

source: http://www.aschroder.com/2012/04/introduction-to-the-magento-rest-apis-with-oauth-in-version-1-7/comment-page-1/#comment-5090 来源: http : //www.aschroder.com/2012/04/introduction-to-the-magento-rest-apis-with-oauth-in-version-1-7/comment-page-1/#comment-5090

Surely, make sure you have the right settings at System > Web Services > Web Roles and System > Web Services > Web Attributes . 当然,请确保在System > Web Services > Web RolesSystem > Web Services > Web Attributes具有正确的设置。

It is also helpful to use the Ruby oAuth library because "it's clean, simple and works well". 使用Ruby oAuth库也很有帮助,因为“它干净,简单并且运行良好”。 See post there . 那里的帖子。

You should try these for this problem in api:- 您应该在api中针对这些问题尝试这些:

1)change the value in the file /app/code/core/Mage/Api2/Model/Auth.php, change the value of: DEFAULT_USER_TYPE = 'guest' to DEFAULT_USER_TYPE = 'admin'. 1)更改文件/app/code/core/Mage/Api2/Model/Auth.php中的值,将以下值更改:DEFAULT_USER_TYPE ='guest'到DEFAULT_USER_TYPE ='admin'。

2)change the value in the file /app/code/core/Mage/Api2/Model/Auth/Adapter.php, change this line from return (object) array('type' => Mage_Api2_Model_Auth::DEFAULT_USER_TYPE, 'id' => null); 2)更改文件/app/code/core/Mage/Api2/Model/Auth/Adapter.php中的值,从返回(对象)数组更改此行('type'=> Mage_Api2_Model_Auth :: DEFAULT_USER_TYPE,'id' => null); to this: return (object) array('type' => Mage_Api2_Model_Auth::DEFAULT_USER_TYPE, 'id' => '1'); 为此:返回(对象)array('type'=> Mage_Api2_Model_Auth :: DEFAULT_USER_TYPE,'id'=>'1'); (note:only change null to '1'). (注意:仅将null更改为“ 1”)。

3)restart your server(for apache run this command: sudo service apache2 restart). 3)重新启动服务器(对于apache,请运行以下命令:sudo service apache2 restart)。 i hope these steps will solve your 403 access denied problem. 我希望这些步骤能解决您的403访问被拒绝的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM