• Resolved joejose1410

    (@joejose1410)


    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 !!
    
Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter joejose1410

    (@joejose1410)

    Problem arises when i try to fetch the response from the url generated , but when i go to the url through the browser i get the authentication page . and when i approve the access this error appears : Error: An error occurred in the request and at the time were unable to send the consumer data.

    Thread Starter joejose1410

    (@joejose1410)

    I would also be grateful if someone shows me how to receive the keys generated .

    Hi,

    You can temporarily switch the site theme to Storefront and disable all plugins except WooCommerce, then try to trigger the error, if you are using Google Chrome, please open the browser developer console, go to the network tab, and then the XHR section.

    Please provide us a screenshot of what you see on your end if there is an error in the console, https://snipboard.io is a good tool to send screenshot links in this forum.

    If that does not help, please share a copy of your site’s System Status Report so that we can get a better context, you can find it via WooCommerce > Status. Select “Get system report” and then “Copy for support”.?

    Roxy

    (@roxannestoltz)

    Hi @joejose1410 ,

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – we’ll be here if and/or when you are ready to continue.

    Cheers!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Auto generating API keys using the Application Authentication Endpoint’ is closed to new replies.