REQUEST_DENIED 使用 Google Places API 浏览器密钥还是应用密钥? [英] REQUEST_DENIED with Google Places API browser key or app key?
问题描述
我正在 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屋!