admin管理员组文章数量:1432589
I developing mobile apps, that connect directly to woocommerce rest api. I use this plugin for authenticating, like registering, login, make an order, etc.
So the issue come, when I register new user (with default role is Customer), I try to make an order : http://123.456.789.910/lili_shop/wp-json/wc/v3/orders , it says :
{
"code": "woocommerce_rest_cannot_view",
"message": "Sorry, you cannot list resources.",
"data": {
"status": 403
}
}
Then I change user role of registered user to "Administrator", it works.
But, what I want is, a new registered user (with default role is Customer) can consume woocommerce API with JWT too, how can I achieve this?
Anyhelp will appreciate.
Thanks.
I developing mobile apps, that connect directly to woocommerce rest api. I use this plugin for authenticating, like registering, login, make an order, etc.
So the issue come, when I register new user (with default role is Customer), I try to make an order : http://123.456.789.910/lili_shop/wp-json/wc/v3/orders , it says :
{
"code": "woocommerce_rest_cannot_view",
"message": "Sorry, you cannot list resources.",
"data": {
"status": 403
}
}
Then I change user role of registered user to "Administrator", it works.
But, what I want is, a new registered user (with default role is Customer) can consume woocommerce API with JWT too, how can I achieve this?
Anyhelp will appreciate.
Thanks.
Share Improve this question asked Feb 22, 2019 at 6:45 Nasihun Amin SuhardiyanNasihun Amin Suhardiyan 11 silver badge3 bronze badges 6 | Show 1 more comment1 Answer
Reset to default 2Not sure if you are still looking for a solution but I ran into a similar issue where I was not able to even retrieve the product listing from a customer account. There were a few things I realized when doing it:
- Since administrator had access it had to be a security issue.
- I installed a user role editor and added some of the extra privileges to see if it would work. (I was testing just the product listing and categories at the time). Note: You can only use read access for the roles in particular if security is an issue.
- This worked and I was able to retrieve the listing for the products and the categories.
I am still looking for a solution to the orders but it definitely involves doing something with security (will edit this post if I do find one). My instinct tells me that JWT Token used in woocommerce checks if the user even have access to edit the information.
It is definitely not an issue with the JWT token but something on woocmmerce side. See this post for details: https://github/woocommerce/woocommerce/issues/17983 Hope this helps.
本文标签: rest apiJWT on Woocommerce cannot work with quotCustomerquot role user
版权声明:本文标题:rest api - JWT on Woocommerce cannot work with "Customer" role user 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745604606a2665766.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
woocommerce_rest_cannot_create
, how? @JacobPeattie – Nasihun Amin Suhardiyan Commented Feb 22, 2019 at 7:57