javascript - 不是客户端的有效来源: url 没有被列入 localhost NOT 127.0.0.1 的客户端 ID 白名单
问题描述
在将其标记为重复之前,我的问题与SO1或SO2不同,而是两者的混合。
我一打开我:/5500
就得到了:Google Calendar API Quickstart
{
"error": "idpiframe_initialization_failed",
"details": "Not a valid origin for the client: http://localhost:5500 has not been whitelisted for client ID 311....idvc2n.apps.googleusercontent.com. Please go to https://console.developers.google.com/ and whitelist this origin for your project's client ID."
}
尽管如此,我在我的 OAuth 2.0 项目中有一个 URL,它同时包含/5000
和/5500
端口(ps 我使用来自 API 密钥的 API 密钥和来自 OAuth2.0 ClientIDs 的客户端 ID)。
但是,一旦我按照SO1建议尝试 SO 清除缓存,它http://127.0.0.1:5500/
仅适用于而不适用于localhost:5500/
. 当我继续单击授权时,我得到:
Error 400: invalid_request
Permission denied to generate login hint for target domain.
SO2的答案是使用哪个localhost
而不是http://127.0.0.1:5500/
哪个,如果我这样做,我会遇到第一个问题循环。
我的代码来自js quickstart。我还尝试根据 SO1 建议启用 Google Plus 和 Google 分析 API。
解决方案
推荐阅读
- jquery - 如何找出在集合中单击了哪个 DIV
- apache-kafka - 生产/消费到远程 Kafka 不起作用
- php - 如何在 Laravel 中使用标准的 php 包?我尝试导入它但找不到它?
- typescript - create-react-app 使用 TypeScript 编译器做什么?
- tensorflow - 这个 TensorFlow 类的用例是什么:image.flip_up_down?
- android - PJSUA2 Android - 来电在 32 秒后掉线
- python - “import foo.bar”和“import foo”的区别?
- c++ - 链表从原始指针创建 shared_ptr
- c - 客户端断开连接后 C 套接字 TCP 服务器失败
- java - Servlet 和 jsp,显示本地目录中的图像列表时出错