Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/396.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 对Places服务的所有请求都必须使用https://协议,并包含API密钥_Javascript_Http_Axios - Fatal编程技术网

Javascript 对Places服务的所有请求都必须使用https://协议,并包含API密钥

Javascript 对Places服务的所有请求都必须使用https://协议,并包含API密钥,javascript,http,axios,Javascript,Http,Axios,每当我向Google的Places API发出axios GET请求时,我都会收到一个错误: "has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource." 我查看了谷歌PlaceAPI的文档,发现: "Each of the services is accessed as an HTTP request, and returns

每当我向Google的Places API发出axios GET请求时,我都会收到一个错误:

"has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is 
present on the requested resource."
我查看了谷歌PlaceAPI的文档,发现:

"Each of the services is accessed as an HTTP request, and returns either an JSON or 
XML response. All requests to a Places service must use the https:// protocol, and 
include an API key."
我是否正确理解,为了使用该API,请求必须来自具有域名和SSL证书的托管网站,以便我可以使用https://协议


我目前正在研究。有没有一种方法可以让我使用这个API,这样我就可以在不使用主机的情况下开发我的应用程序?

文档中说的是什么

所有请求都必须使用https,并且必须包含API密钥

CORS的事情表明

请求必须来自服务器,而不是浏览器


这并不意味着服务器必须是https服务器,它只需要使用https对该API发出请求,我是否理解正确。。。它说所有的请求都必须使用https,并且必须包含API密钥——CORS的东西表明,是的,请求必须来自服务器,而不是浏览器,但服务器不必“服务”https,它只需要使用httpsSo发出请求我需要后端使用服务器端语言,如PHP或Node.js发出请求?是的,完全正确因此,在我的例子中,如果我想从该API获取数据,我需要从我的服务器向google API发出请求,然后从我的Vue.js前端向我自己的服务器发出请求?是的,也是这样