I am trying to develop an app to query a store’s orders. The app is a public app ie will be installed by many stores but I am currently testing it on a development store.
The documentation is somewhat confusing and is very limited with no proper examples. Therefore, I wanted to report this here with the hope of getting some guidance.
Below is my app.js for a node application using “@shopify/shopify-api”: “^9.3.1”
require('@shopify/shopify-api/adapters/node');
const { shopifyApi, Session } = require('@shopify/shopify-api');
const shopify = shopifyApi({
apiKey: 'The Client ID that I got from partners panel',
apiSecretKey: 'The Client key that I got from partners panel',
scopes: ['read_customers', 'read_orders'],
hostName: 'https://XXXXXXXXX.ngrok-free.app',
});
const sessionId = shopify.session.getOfflineId("mystore_address.myshopify.com");
const session = new Session({
id: sessionId,
shop: "mystore_address.myshopify.com",
isOnline: false,
accessToken: 'permanentAccessToken',
});
const client = new shopify.clients.Rest({ session: session });
client.get({
path: 'products',
}).then((val) => {
console.log(val);
});
I keep getting the following example and I would be grateful if you could share any guidance you might have.
errors: ‘[API] Invalid API key or access token (unrecognized login or wrong password)’