![](/img/trans.png)
[英]React and Redux: 401 Unauthorized Error POST API Request
[英]Ionic 3 WP-REST API Post request 401 (unauthorized) error
我正在開發一個簡單的應用程序,以通過wp-rest api在Wordpress(woocommerce)中創建用戶。 但是當我嘗試創建新客戶時,它在控制台中顯示401 Unauthorized錯誤。 這是我的要求代碼。
signup(){ let customerData = { customer : {} } customerData.customer = { "email": this.newUser.email, "first_name": this.newUser.first_name, ... "billing_address": { "first_name": this.newUser.first_name, ... }, "shipping_address": { "first_name": this.newUser.first_name, ... } } if(this.billing_shipping_same){ this.newUser.shipping_address = this.newUser.shipping_address; } this.WooCommerce.postAsync('customers', customerData).then( (data) => { console.log(JSON.parse(data.body)); }) }
您需要一個https
連接,將以下行添加到woocommerce init中:
verifySsl: false,
queryStringAuth: true
任何post
請求都需要https
連接。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.