Shopify nodejs api http error 403 forbidden

Highlighted
New Member
4 0 0

 

hi,

i am trying to create a small nodejs app using the nodejs package at https://github.com/MONEI/Shopify-api-node. This is the super simple code:

'use strict';

// [START gae_node_request_example]
const express = require('express');

const app = express();
const escapeHtml = require('escape-html');
const Shopify = require('shopify-api-node');


const shopify = new Shopify({
    shopName: 'italbeauty-it',
    apiKey: 'xxxx',
    password: 'xxxx'
});

app.get('/', (req, res) => {
  res.status(200).send('Hello, world!').end();

  //Product list view
  app.get('/shopify_products',function(req, res){
      shopify.product.list()
    .then(product =>
      //res.send(product)
      res.render('product',{
        title: "product",
        product: product
    })
    )
    .catch(err => console.error(err));
  });

});

// Start the server
const PORT = process.env.PORT || 8080;
app.listen(PORT, () => {
  console.log(`App listening on port ${PORT}`);
  console.log('Press Ctrl+C to quit.');
});
// [END gae_node_request_example]

module.exports = app;

every time i tried to run the shopify.product.list() i get the following error:

HTTPError: Response code 403 (Forbidden)

 

But if i try to make the same call from postman it works with no issues

 

I doublechecke the api and the password and they are correct (and they work in postman)

 

Really appreciate if someone can help me fixing this issue, thank you!

0 Likes