Verify Private app configuration

I am new to app development. My aim is to use the Shopify API to access orders in our Shopify store.

I have set up a private test app and given it just about every possible permission.

I keep getting a 401 using the script below and I am wondering if there is an automated way to check that the app has been properly configured.

Thx, Eric

const fetch = require(‘node-fetch’);
const shopifyDomain = ‘MyStoreName.myshopify.com’; // Replace with your Shopify domain
const accessToken = ‘MyAdminAccessToken’; // Replace with your admin access token
const testApi = async () => {
const url = https://${shopifyDomain}/admin/api/2023-01/shop.json;

try {
const response = await fetch(url, {
method: ‘GET’,
headers: {
‘Content-Type’: ‘application/json’,
‘X-Shopify-Access-Token’: accessToken
}
});

if (!response.ok) {
throw new Error(Error: ${response.status} - ${response.statusText});
}

const data = await response.json();
return data.shop;
} catch (error) {
console.error(‘Error testing API:’, error.message);
}
};

testApi().then(shop => {
if (shop) {
console.log(‘Successfully connected to the shop:’, shop);
}
});

Some additional clarification: The app was created in the store’s admin section and permissions given were for admin-api. I used the admin-api-token when attempting to access the API.

Oh jeez…never mind. I had swapped the API Key and access token.

I suppose I am not the first one to do this…

Glad you figured this out Epodietz!