FROM CACHE - en_header

Can you pass somehow Shopify API Key and Password through fetch to get data from Shopify API orders,

Shopify Partner
11 3 7

I have a problem with my javascript fetch when I try to run it on the live Shopify store I get this error "{"errors":"[API] Invalid API key or access token (unrecognized login or wrong password)"}" can I somehow pass API key and Password through fetch and get data back from Shopify API REST orders, products, etc.. here is how code looks now.


fetch(apiRequest, {
        mode: 'no-cors',
        cache: 'no-cache',
        withCredentials: true,
        credentials: 'same-origin',
        crossdomain: true,
        redirect: 'follow', 
        agent: null, 
        headers: {
            'Access-Control-Allow-Origin': '*',
            'Content-Type': 'application/json',
            'Authorization': 'Basic ' + btoa(`${apiKey}:${password}`)
        .then(response => response.json())
        .then((orders) => {
            orders['orders'].forEach((order) => {
                // console.log(`Orders: `, order);
                // We get all order details and now from then we push to arrays finded product id and variant id it must be the same arrays length //
                order['line_items'].forEach((line) => {
            // Clearning null, duplicates and empty values //
            let products = productsIds.filter((a) => a);
            let variants = variantsIds.filter((a) => a);

            products = [ Set(products)];
            variants = [ Set(variants)];

            console.log(`Products ids: `, products);
            console.log(`Variants ids: `, variants);
        .catch((error) => {
Stefan Momcilovic
Replies 0 (0)