REQUEST_DENIED 与 Google Places API 浏览器密钥或应用程序密钥? [英] REQUEST_DENIED with Google Places API browser key or app key?

查看:51
本文介绍了REQUEST_DENIED 与 Google Places API 浏览器密钥或应用程序密钥?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 Android 中编写一个需要 Google Places API 的应用程序.我已经通过 Google 控制台为我的浏览器和我的特定应用程序制作了一个密钥.应用程序密钥已适用于 Google 地图.不过,要向 Google Places API 发出请求,我似乎必须使用浏览器密钥才能使其工作.它不适用于应用程序密钥,因为这会导致 REQUEST_DENIED.

I'm writing an application in Android that needs the Google Places API. I have made a key through the Google console, for both my browser and my specific application. The application key already works with Google Maps. To do a request to the Google Places API, though, it seems I have to use the browser key for it to work. It won't work with the application key, because that results in a REQUEST_DENIED.

有人知道这怎么可能吗?还是这正常?

Somebody knows how this is possible? Or is this normal?

推荐答案

访问 Google 地点 API 涉及来自浏览器的 http/https 请求.您创建的应用程序密钥不适用于 Google 场所,因为它需要浏览器密钥.您需要在 Google API 控制台上点击创建新的浏览器密钥"

Accessing Google places API involves a http/https request from the browser. The application key you created wouldn't work for the Google places as it needs a browser key. You need to create a new browser key on the Google API console clicking the "Create new Browser Key"

同时将接受来自这些 HTTP 引荐来源网址(网站)的请求:留空,以便它允许访问所有引荐来源网址并包括在您的查询 URL 中生成的密钥.

Also leave the Accept requests from these HTTP referers (web sites): blank so that it allows access to all referrers and include the key generated in your query URL.

这篇关于REQUEST_DENIED 与 Google Places API 浏览器密钥或应用程序密钥?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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