'[API] Invalid API key or access token (unrecognized login or wrong password)'

samshhopifyNewb
Tourist
14 0 0

Hi guys, I am trying to access the checkout.json file on my store but I receive an error. I can access the json in a browser but not when I attempt to pull it. I am new to React JS so I am not sure if I am doing something very obviously wrong!

The error - '[API] Invalid API key or access token (unrecognized login or wrong password)'

This is the code (api keys have been swapped out, but they are correct). Any help appreciated!!

 

    fetch('https://apiuser:apipass@test-store-ccapp.myshopify.com/admin/api/2020-07/checkouts.json')
    .then(response => response.json())
    .then((jsonData) => {
    // jsonData is parsed json object received from url
    var data = jsonData;
    for (var i = 0; i < data.length; i++)
        {
             var obj = data[i];
        console.log("Email: " + obj.email + ", Phone Number: " + obj.phone);
        }
        console.log(jsonData)
     })
 
 
Reply 1 (1)

Kevin_A
Shopify Staff
318 42 61

Hey @samshhopifyNewb 

I believe you need to use OAuth for the checkout API. See this tutorial for more details.

Kevin_A | Solutions Engineer @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog