Я занимаюсь разработкой простого приложения для создания пользователя в Wordpress (woocommerce) через API wp-rest. но когда я пытаюсь создать новых клиентов, в консоли отображается 401 Несанкционированная ошибка. вот мой код для запроса.
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:
https
verifySsl: false, queryStringAuth: true
Любой запрос post требует подключения https.
post