我正在尝试开始使用 Google 跟踪代码管理器 API。有谁知道为什么我在控制台中看到以下错误,即使我已将 http://localhost
和 http://localhost:8080
添加到授权的 JavaScript起源于 API 凭据页面?
details: "Not a valid origin for the client: http://localhost has not been whitelisted for client ID xxxx.apps.googleusercontent.com . Please go to https://console.developers.google.com/ and whitelist this origin for your project's client ID." error: "idpiframe_initialization_failed"
最佳答案
这绝对可能在本地主机上进行测试。
1) 在您的项目上激活 Analytics 和 Google Tag Manager API
2) 创建新的 OAUTH 2.0 客户端凭证
3) 在限制部分添加授权的 Javascript 来源
4) 使用新的客户端 ID。
当您使用客户端 key 而不是客户端 ID 时,经常会出现此问题,请确保您没有混合使用它们。
编辑:尝试清空缓存
关于javascript - Google 标签管理器 API 错误“不是客户端的有效来源 : http://localhost has not been whitelisted for client ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47608487/