rest api – Auto generating API keys using the Application Authentication Endpoint

Question

I am trying to auto generate API keys from a woocommerce website , but I am getting an error like this :
name:”FetchError”
message:”invalid json response body at https:/……………
………………………..reason: Unexpected token < in JSON at position 0″
type:”invalid-json”

this is the code I have used , i have changed website names to sample names :

  const store_url="https://sample.com/";
            const endpoint="wc-auth/v1/authorize";
            const query_string = new URLSearchParams([
                ['app_name', 'MyShoppingWebsite'],
                ['scope', 'read_write'],
                ['user_id', '123'],
                ['return_url', 'https://example.com/apipractice'],
                ['callback_url', 'https://example.com/apipractice']
            ]).toString();
    const url = store_url + endpoint + '?' + query_string;

this is run from another website .
any help is appreciated , thank you !!

0
Joejo 2 months 2023-01-30T10:15:53-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse