Mic*_*son 5 console google-api google-oauth
我最近将一个项目移到了另一台服务器上.域名是相同的,刚刚指向新服务器.URL完全相同.自从移动项目以来,当应用程序尝试连接到谷歌OAuth api时,我收到此错误.
{
"name": "Error calling GET https:\/\/www.googleapis.com\/analytics\/v3\/management\/accounts\/~all\/webproperties\/~all\/profiles?key=AIzaSyBKUP8JriiOnFnbJm_QYt_bHTMuHf-ilAI: (403) There is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your API key configuration if request from this IP or referer should be allowed.",
"url": "\/analytics\/statistics.json"
}
Run Code Online (Sandbox Code Playgroud)
显而易见的原因(基于错误消息)是我没有将新服务器IP添加到devlopers控制台中的API和auth-> Credentials->服务器应用程序密钥下的允许IP列表中.
我添加了IP.我已经通过ping它来检查域名已经传播,并且已经在控制台中输入了新的IP,所以我很难弄清楚它为什么不起作用.
有没有人在遇到这个问题之前可以帮我解决一下?
我也遇到这个问题有一段时间了,但最终解决了:
我注意到,当我在服务器上尝试时,wget http://bot.whatismyipaddress.com/它实际上会返回一个 IPv6 地址,而在 API 密钥的配置页面上,我输入了服务器的 IPv4 地址。添加 IPv6 地址后,我的请求终于被接受。