[API] Invalid API key or access token (unrecognized login or wrong password). Put default address

Solved
brodrig
Tourist
11 1 2

Hi, I have a working private app for my store. I have a lot of working requests to Shopify Admin Api, and right now I'm having an issue with setting a customers default address. I am able to get and create addresses but I want the user to be able to input a new default address. If a user inputs an address, and it already exists on his account, I simply make that address the default address. This is where I'm running into a problem. Once I already have identified the address which the user is looking for, I get the address id and do a put request to set it as the default. However for this specific put request, I am for some reason getting a 401 permission denied error, it doesn't make any sense.

Additionally, I try the same exact request through POSTMAN with all of the same variables and it works perfectly and sets the users default address. The error comes when I try to make the request from Node.js on my private app.

My request url: 'https://(my-store@myshopify.com)/admin/api/2020-04/customers/(customer_id)/addresses/(address_id)/default.json'

Headers:

{"X-Shopify-Access-Token":"(Shopify_offline_token)",

"Accept":"application/json",

"Content-Type":"application/json"}

Type of request: PUT.

For reference, an x-request-id is: 

b50997d9-575d-458e-964d-130acba7d2b6

What am I doing wrong and how can I fix this?

0 Likes
brodrig
Tourist
11 1 2

This is an accepted solution.

Solved, ended up having to send empty put data for it to work.

0 Likes