REQUEST_DENIED与谷歌的地方API浏览器键或应用程序键?应用程序、浏览器、地方、REQUEST_DENIED

2023-09-12 06:34:55 作者:淡淡的温柔

我写的Andr​​oid的应用程序,需要谷歌的地方API。 我已经通过谷歌控制台的关键,为我的浏览器,我的具体应用。该应用程序键已经可以与谷歌地图。 要做到一个请求,谷歌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?

推荐答案

访问谷歌的地方API,包括来自浏览器的HTTP / HTTPS请求。你所创建的应用程序键不会对谷歌的地方工作,因为它需要一个浏览器键。您需要创建的谷歌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.