【问题标题】:Woocommerce rest authentication error 401Woocommerce 休息认证错误 401
【发布时间】:2017-02-23 14:59:42
【问题描述】:

我在 Woocommerce Rest Api 上收到 401 错误

  • Woocommerce 最新版本
  • WP 调试已禁用
  • Nginx 服务器
  • 正确验证配置(密钥)

{"code":"woocommerce_rest_authentication_error","message":"Assinatura inv\u00e1lida - a assinatura fornecida n\u00e3o confere.","data":{"status":401}}
{'x-robots-tag': 'noindex', 'x-content-type-options': 'nosniff', 'x-powered-by': 'PHP/5.5.9-1ubuntu4.17', 'transfer-encoding': 'chunked', 'access-control-expose-headers': 'X-WP-Total, X-WP-TotalPages', 'keep-alive': 'timeout=5', 'server': 'nginx', 'connection': 'keep-alive', 'link': '<http://subdomain.example.com/wp-json/>; rel="https://api.w.org/"', 'date': 'Thu, 23 Feb 2017 14:51:35 GMT', 'access-control-allow-headers': 'Authorization, Content-Type', 'content-type': 'application/json; charset=UTF-8'}

import sys
from WooCommerceClient import WooCommerceClient
import pprint

wc_client = WooCommerceClient('ck_8fe372c78d82bf65ff454f68abfe35b8d6140e9d', 'cs_52bd7c4693a26808b66edb7d1f7cad98e5cb213f', 'http://subdomain.example.com/')
pprint.pprint(wc_client.get_products())

【问题讨论】:

    标签: nginx woocommerce-rest-api


    【解决方案1】:

    问题是 Nginx 服务器阻塞:

    location / {
            try_files $uri $uri/ /index.php?q=$uri&$args;
    }
    

    位置块(对于 woocommerce)的正确配置是:

    location / {
    try_files $uri $uri/ /index.php?$args;
    } 
    

    在此之后重启 nginx。

    【讨论】:

      猜你喜欢
      • 2019-02-21
      • 2015-06-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多