New Shopify Certification now available: Liquid Storefronts for Theme Developers

Client Id parameter coming up undefined using shopify-node-api when building auth URL

zsam56
Shopify Partner
1 0 0

I want to use the shopify-node-api library to conduct OAuth to connect to my clients' Shopify store to view products.

My config looks like so:

const shopifyConfig = {
  shop: 'marketpryce-test.myshopify.com',
  api_key: process.env.SHOPIFY_API_KEY,
  shared_secret: process.env.SHOPIFY_SECRET_KEY,
  redirect_uri: 'localhost:3000/matches',
  shopify_scope: 'read_products',
  nonce: randomUUID()
};

 

I'm calling the buildAuthUrl() function which generates a url with the client_id param set like so:

client_id=undefined

I've logged my env variable at runtime and it is successfully getting my API Key and Secret Key for my app so I'm not sure why the client_id is coming up undefined. 

Does my app need to be in a different state in order to successfully complete the OAuth workflow? I'm trying to test it using a development store that I've created. 

Reply 1 (1)
Liam
Shopify Staff
Shopify Staff
1917 204 579

Hi Zsam56 - is this the library you're using? If so, you may need to open an issue in that repo describing the Auth issues you're experiencing. It also seems to be an old library so there may be aspects that are not currently supported. 

Liam | Developer Advocate @ 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