Google 地理编码 API 拒绝请求 - NodeJS

Google Geocode API deny the request - NodeJS

我想在 NodeJS 中对街道地址进行地理编码,但是 google API 拒绝请求,因为 IP 地址。我的服务器上有专用 IP 地址,我生成的 API 密钥使用了这个 IP 地址。我的请求如下所示:

https.get('https://maps.googleapis.com/maps/api/geocode/json?address=MY_ADDRESS&key=MY_KEY', 函数(响应){................});

我注册了我当前 public 我的计算机的 IP 地址只是为了尝试 API 如果我从我的计算机发送请求它工作正常。

我在 google 开发者网站上找到了以下说明:"Every API request is generated by software running on a machine that you control. Per-user limits will be enforced using the address found in each request's userIp parameter, (if specified). If the userIp parameter is missing, your machine's IP address will be used instead."

是不是意味着我可以这样添加userIp参数?:

https.get('https://maps.googleapis.com/maps/api/geocode/json?address=MY_ADDRESS&key=MY_KEY&userIp=MY_IP', 函数(响应){................});

我也试过这个,但还是不行。有人知道我做错了什么吗?

好吧,我认为设置规则后需要一些时间才能激活规则。 如果您使用它来测试您的应用程序,您可以设置一个允许 ip 0.0.0.0/0 的服务器密钥,换句话说,任何 ip 地址。

而且我认为您无法覆盖请求的 IP 地址。你所指的测试是关于 Per-user limits.