且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Drive API 的 Google API OAuth 无法正常工作.出现错误:origin_mismatch

更新时间:2022-11-07 21:37:31

你没有提供太多关于你的应用程序架构的细节,所以我只能建议一个一般性的答案.OAuth 限制哪些 URL 可以引用它.允许的 URL 列表在 API 控制台中配置,位于 https://code.google.com/apis/控制台.URL 非常繁琐,因此请确保输入的内容与地址栏中显示的内容完全相同.

You haven't given much detail about your application architecture, so i can only suggest a general answer. OAuth restricts which URLs can be referred to it. The list of permitted URLs is configured in the API console at https://code.google.com/apis/console. The URL is very fussy, so make sure you enter it exactly as it appears in the address bar.

截至 2013 年 10 月,您不能使用 localhost.您有 2 个选择.

As at Oct 2013, you can't use localhost. You have 2 choices.

  1. 将 127.0.0.1 = mydevserver.example.com 编辑到您的/etc/hosts 中
  2. 使用 url 缩短器(例如 goo.gl)创建 localhost 的别名

不过,我相信现在可以在谷歌 API 控制台.

However, I believe that it is now possible to configure localhost in the Google api console.