cancel
Showing results for 
Search instead for 
Did you mean: 

Using M2 REST API to connect with NodeJs

Using M2 REST API to connect with NodeJs

Hey folks,

 

I'm new to the Magento world and I'm trying to build a NodeJs app the runs alongside our Magento2.3.4 website.  We were previously using Zoey and I had the integration working no problem there, but I'm having trouble authenticating.  I've tried using many npm packages but I get the same error: "The consumer isn't authorized to access Magento_Customer::customer."  It should be noted that I am able to get the product data because I set the Allow Anonymous Guest Access in Web API Security to yes.  I am really trying to get orders, customers etc.

 

I have set up a user with admin role and access to all api endpoints.  I've created an integration and used the consumer key/secret token/secret as the credentials as well as trying the username and pw of the user I created for it.  I can share code if there is anyone that has done this.  I have a few different scripts that are trying to do the same thing with different packages, so I'm not sure which to show here.  

I've tried these packages:

-oauth1.0a and encrypting/adding to headers without a pkg

-magento-api-rest which is 'axios-like'

-magento2-rest-client

-node-magento2-rest-api

-magento-api-rest this is the most recently updated but doesn't support all endpoints

 

Any help with this would be greatly appreciated.

 

Thanks,

Dan

2 REPLIES 2

Re: Using M2 REST API to connect with NodeJs

Do you get any idea about this issue? Please guide me also.  

VIVEK KT
Software Developer

Re: Using M2 REST API to connect with NodeJs

Hello @dandanjome3465  and @VIVEK KT  

 

a module is available to make the connection between Magento 2 rest API and node js applications

 

https://github.com/vuestorefront/magento2-rest-client

 

Thanks