此IP,网站或移动应用程序未被授权使用此API密钥 [英] This IP, site or mobile application is not authorized to use this API key

查看:162
本文介绍了此IP,网站或移动应用程序未被授权使用此API密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 https://maps.googleapis.com/maps/api/geocode/json?链接与服务器密钥和用户IP寻找任何地址的经度和纬度,当我试图我发现错误为



我有一个服务器访问键从谷歌和我把我的服务器的IP地址放在他们的白名单中。



我试图通过PHP CURL访问的URL是:



https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=true&key=XXXXXXXXXXXX



我得到的结果是:

  Array([error_message] =>此IP,网站或移动应用程序未被授权使用此API密钥。[results] => Array()[status] => REQUEST_DENIED)

有什么我需要配置的。
地理编码API也已打开。

解决方案

我遇到同样的问题,



在网址上,它最终需要服务器密钥,而不是应用程序的api密钥。



因此,基本上,您只需在URL末尾添加服务器密钥,如下所示:

https://maps.googleapis.com/maps/api/place/nearbysearch/ json?location = yourlatitude,yourlongitude& radius = 5000& sensor = true& key = SERVERKEY 现在,要获得服务器密钥,只需请按照以下步骤操作:



1)转到开发者控制台https://code.google.com/apis/console/



2)中公共API访问下的凭证,C reate New key



3)从选项中选择服务器密钥。 4)在该字段中输入您的IP地址,如果您有更多的IP地址,则可以在每一行添加。注意:只在需要时输入IP地址将其用于您的测试目的。否则,请将IP地址部分留空。



5)完成后,请点击创建并生成新的服务器密钥,然后您可以将该服务器密钥添加到您的网址。



最后一点是,不要将传感器= true置于URL中间,您可以像这样在最后添加它:



https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=yourlatitude,yourlongitude&radius=5000&key=SERVERKEY&sensor=true



这一定会解决问题,只记得为 Places API 使用服务器密钥。



希望这个答案能够帮助你和其他观众。好运..:)

I am using https://maps.googleapis.com/maps/api/geocode/json? link with server key and user ip to find the latitude and longitude of any address , when i m trying i am finding the error as

I have a server access key from google and I have put my server's IP address in the their white list.

The URL that I am trying to access via PHP CURL is:

https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=true&key=XXXXXXXXXXXX

The result that I am getting:

Array ([error_message] => This IP, site or mobile application is not authorized to use this API key. [results] => Array ( ) [status] => REQUEST_DENIED)

Is there anything that I need to configure. The geocoding api is also switched on.

解决方案

I had the same issue and I found this.

On the url, it requires the server key in the end and not the api key for the app.

So Basically, you just add the server key in the end of the URL like this:

https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=yourlatitude,yourlongitude&radius=5000&sensor=true&key=SERVERKEY

Now, to obtain the server key, just follow these steps:

1) Go to Developer Console https://code.google.com/apis/console/

2) In the Credentials, under Public API Access , Create New key

3) Select the server key from the option.

4) Enter your IP Address on the field and if you have more ip addresses, you can just add on every single line.NOTE: Enter the IP Address only when you want to use it for your testing purpose. Else leave the IP Address section blank.

5) Once you are done, click create and your new Server Key will be generated and you can then add that server key to your URL.

Last thing is that, instead of putting the sensor=true in the middle of the URL, you can add it in the end like this:

https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=yourlatitude,yourlongitude&radius=5000&key=SERVERKEY&sensor=true

This will definitely solve the issue and just remember to use the server key for Places API.

Hope this answer will help you and other viewers. Good Luck .. :)

这篇关于此IP,网站或移动应用程序未被授权使用此API密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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