'How to access the Woocommerce REST API in node.js ( REACT-native ) without using the library '@woocommerce-rest-api'?
I'm trying to contact the WooCommerce REST API with regular fetch requests. This works if I use consumer_key and consumer_secret right in the query string:
https://my-site.ru/wp-json/wc/v3/orders?consumer_key=ck_817d29ef4g409b34п5e215d66e98cfeeb80982f1&consumer_secret=cs_880b76d36h204b32471f328c014а4c081ca03223
But if I try to insert keys into the request body in any way, it returns a 401 error. I tried it in different ways, but apparently I prescribe something wrong. All the examples in Google are used with the @woocommerce-rest-api module, which for some reasons I can't use. Even the standard appeal via oauth 1.0 does not work
let WooCommerce = {
url: 'https://my-site.ru', // Your store URL
Authorization : 'oauth 1.0',
consumer_key: 'ck_817d29ef45609b3738e215d66e98cfeeb80982f1', // Your consumer secret
consumer_secret: 'cs_880b76d31м304b32471f328c0ce44c081ca03223', // Your consumer secret
ssl: true,
version: 'wc/v3',
wpAPI: true,
queryStringAuth: true };
Tell me how to correctly specify the keys in the body of the fetch request so that the REST API accepts them
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
