0

I'm working with a REST API that requires authentication. I sent a request from my local machine using python and Got a successful response. When I did the same request using javascript (hosted on Wix Velo) I got a 400 error. I've used a request grabber to compare the bodies of the two requests. They're identical. Below is the information that the request grabber gave me about the requests.

Successful python request info (Body hidden as it's identical to the one in the other request)

Accept: / Accept-Encoding: gzip, deflate, br Authorization: Bearer <my_API_key> Connection: keep-alive Content-Length: 376 Content-Type: application/json User-Agent: python-requests/2.28.1s.

Unsuccessful JS request info

Connection: close Accept: / Accept-Encoding: gzip,deflate Authorization: Bearer <my_API_key> Connection: close Content-Length: 376 User-Agent: node-fetch/1.0 (+https://github.com/bitinn/node-fetch)

Any insight into why exactly the request is not working from the web would be wonderful.

I've really tried everything. I verified that the python request works, I verified the bodies are received as the exact same text. I know my API key works. I don't think it could be a CORS error as I can use my wix-hosted JS to do other things with that API.

Bob Arnson
  • 21,377
  • 2
  • 40
  • 47

0 Answers0