Uber API不允许来自本地主机的请求 [英] Uber API doesn't allow request from localhost

查看:76
本文介绍了Uber API不允许来自本地主机的请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在本地主机上使用Uber API时,收到以下错误:

When I use the Uber API, with localhost I receive the following error:

...上没有'Access-Control-Allow-Origin'标头请求的资源。因此,不允许访问源' http:// localhost:8080

... No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.

所以我可能出错了。为了进行测试,我在Postman中尝试了该url,但是一切正常。我收到了预期的JSON数据。我也尝试过卷曲。

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.

此报价提示了先前的答案: Uber API实现了OAuth 2.0标准以进行安全身份验证和
授权。所有与我们服务器的通信必须通过SSL(https://)。

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://)."

这是否意味着我必须使用https://?在此之前,我没有遇到任何其他API的问题。

Does this mean I have to use https:// ? I haven't had issues with any other APIs before this.

推荐答案

是的,您需要使用https。有些api需要它,而其他api则取决于接收的应用程序。

Yes you need to use https. Some apis require it, others will take either depending on the receiving application.

这篇关于Uber API不允许来自本地主机的请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆