Context influences requests (Response code 401 (Unauthorized))
See original GitHub issueI am trying to create a public app.
When trying to create a product from inside my application it throws with : Response code 401 (Unauthorized)
However when I create a node script like this:
const Shopify = require('shopify-api-node')
const createProduct = async () => {
const shopify = new Shopify({
accessToken: ****,
shopName: ****,
apiVersion: '2020-04',
})
const res = await shopify.product.create({ title: 'Test' })
console.log(res)
}
createProduct()
the product gets created successfully.
I tried to paste the exact same code in my application, but I still get the 401.
My application is built apollo-server-micro and running as an api route from next.js
If you need more info, I am happy to provide.
Issue Analytics
- State:
- Created 3 years ago
- Comments:16
Top Results From Across the Web
403 Forbidden vs 401 Unauthorized HTTP responses
The 401 (Unauthorized) status code indicates that the request has not been applied because it lacks valid authentication credentials for the target resource....
Read more >401 Unauthorized Error: What It Is and How to Fix It
The 401 Unauthorized Error is an HTTP response status code indicating that the client could not authenticate a request.
Read more >Authentication Filters in ASP.NET Web API 2 - Microsoft Learn
If the server does not accept the credentials, it returns a 401 (Unauthorized) response. The response includes a Www-Authenticate header that ...
Read more >Forbidden (403), Unauthorized (401), or What Else? - Auth0
How to use HTTP status code in the authorization context? When to use "401 Unauthorized" status code? When to use "403 Forbidden"?
Read more >API limits – Asana
401, Unauthorized, A valid authentication token was not provided with the request, so the API could not associate a user with the request....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@BjoernRave this is a dirty workaround but it should work if you are not using the proxy functionality. In the module where you require
auth0for the first time doNot sure if it breaks the
auth0module but it should not.Edit: I’m confident it does not break
auth0if the proxy functionality is not used as per https://github.com/ngonzalvez/rest-facade/blob/v1.13.0/src/Client.js#L321-L323.Yes, I ran
npm ls agent-baseafter installing the latest version ofauth0and everything looks good. It should work without issues.