问题
When I use the Uber API, with localhost I receive the following error:
... No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.
So maybe I made an error. To test, I tried the url in Postman, but everything works as expected; I receive the expected JSON data. I also tried with curl. It works as expected.
I am sending my server token and I've adjusted my headers. No luck.
Previous SO answers hinted at this quote: "The Uber API implements the OAuth 2.0 standard for secure authentication and authorization. All communication with our servers must be over SSL (https://)."
Does this mean I have to use https:// ? I haven't had issues with any other APIs before this.
回答1:
Yes you need to use https. Some apis require it, others will take either depending on the receiving application.
来源:https://stackoverflow.com/questions/36269501/uber-api-doesnt-allow-request-from-localhost