MONEI / Shopify-api-node

Node Shopify connector sponsored by MONEI
https://monei.com/shopify-payment-gateway/
MIT License
945 stars 278 forks source link

Shopify API GET requests returning "Response code 401 (Unauthorized)" #533

Closed fagnanigm closed 1 year ago

fagnanigm commented 2 years ago

Hey guys! What's up?!

I built an application using serverless by creating Lambda on AWS. These lambdas work as endpoints and you can call them via GET or POST.

Nowadays, I have many custom GET functions that are using the API to fetch and update order information (get and post) and it is working fine.

The problem is when I try to access this API through a lambda post function, I get an error message (Response code 401 (Unauthorized))

[ERROR] HTTPError: Response code 401 (Unauthorized)

This is very strange because when I get this error, the API calls that were working through my GETs methods stop working and have the same problem for 1 or 2 minutes.

A workaround, was to call the direct URL through AXIOS and my access token, and it worked perfectly, but the issue is that I want to maintain a default using this library.

Does anyone have any idea what I could be doing wrong?

ravimisra commented 1 year ago

I am having the very same issue.

mwolfeio commented 1 year ago

I was having the same issue. Shopify recently updated the way they handle "developer application". Try the following these steps:

  1. Create a new developer application
  2. Chose Admin API and give the app the appropriate configuration ("permissions")
  3. (THE CAUSE OF YOUR PROBLEM) when configuring your shopify-api-node store instance, use the new "Admin API access token" as the password instead of the "API secret key"

This fixed everything for me. hope it helps you!

lpinca commented 1 year ago

I'm closing this as answered by @mwolfeio's comment.