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

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

问题描述

我使用Google Places API,要求您提供允许使用该服务的IP列表。这个API在我的本地机器上运行良好,但它给出了一个


这个IP,站点或者移动应用程序没有被授权使用这个API
key


当我从我的生产服务器上使用它时。我已经添加了所需的IP。任何其他想法可能是什么问题或如何调试?

解决方案

我有同样的问题,我发现这个。



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



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

https://maps.googleapis.com/maps/api/place/附近的搜索/ json?location = yourlatitude,yourlongitude& radius = 5000& sensor = true& key = SERVERKEY

现在,要获得服务器密钥,请按照以下步骤操作: 转到开发者控制台 https://code.google.com/apis/console/



2)在Publi下的凭证中c API访问,创建新密钥



3)从选项中选择服务器密钥。

)输入你的IP地址,如果你有更多的IP地址,你可以在每一行添加。注意:输入IP地址只有当你想用它来达到你的测试目的。



5)完成后,点击create,您的新服务器密钥将会生成,您可以然后将该服务器密钥添加到您的URL中。



最后一件事是,不要将sensor = true放在URL中间,您可以在最后添加它像这样:



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

这肯定会解决问题,只记得使用服务器密钥来放置api。



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

I'm using the Google Places API which requires that you give a list of IPs which are allowed to use the service. The API works great on my local machine but it give a

This IP, site or mobile application is not authorized to use this API key

when I use it from my production server. I've added the required IPs. Any other ideas what might be the issue or how to debug it?

解决方案

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天全站免登陆