登录时 WooCommerce REST API 身份验证失败 [英] WooCommerce REST API Authentication fails when logged in
本文介绍了登录时 WooCommerce REST API 身份验证失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我在同一浏览器中登录 Wordpress 时,WooCommerce REST API 身份验证失败.
WooCommerce REST API Authentication is failing when I am logged into Wordpress in the same browser.
退出 - 一切正常
登录 - 并收到此错误:
Log in - and get this error:
{"code":"woocommerce_rest_cannot_view","message":"Sorry, you cannot view this resource.","data":{"status":401}}
Ajax 也是如此:
jQuery.ajax({
url:'https://example.com/wp-json/wc/v1/products/30552?consumer_key=ck_xxx&consumer_secret=cs_xxx',
success:function(d){window.d = d;}
});
尝试直接在浏览器中访问相同的 URL 时.
and when trying to access the same URL directly in the browser.
是什么导致了这种情况?
What could be causing this situtation?
我想不出任何有用的理由.
I can't think of any useful reason for it.
推荐答案
WooCommerce 2.7 已修复此问题.
This has been fixed for WooCommerce 2.7.
https://github.com/woocommerce/woocommerce/commit/b1b2a6975aa19a2967466acc90a6547a
https://github.com/woocommerce/woocommerce/commit/b1b536b5d2aa19a2967466acc90a6547955b8595
这篇关于登录时 WooCommerce REST API 身份验证失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文