Drive API 的 Google API OAuth 不起作用.获取错误:origin_mismatch [英] Google API OAuth for Drive API is not working. Getting Error: origin_mismatch
问题描述
我正在尝试运行 Google Drive 的实时 API 的快速入门代码.我相信我做对了一切.但我得到了
I am trying to run the quick start code of Real Time API of Google Drive. I believe I did everything right. But I am getting
Error: origin_mismatch
Request Details
openid_connect_request=true
cookie_policy_enforce=false
scope=https://www.googleapis.com/auth/drive.install https://www.googleapis.com/auth/drive.file https://www.googleapis.com/auth/plus.me
response_type=token
access_type=online
redirect_uri=postmessage
proxy=oauth2relay601571239
origin=http://127.0.0.1
state=811328575|0.818765953
display=page
client_id=XXXXXXXXXX
推荐答案
您没有提供关于您的应用程序架构的太多细节,所以我只能建议一个一般性的答案.OAuth 限制了哪些 URL 可以被引用.允许的 URL 列表在 API 控制台中配置,地址为 https://code.google.com/apis/控制台.该网址非常繁琐,因此请确保输入的网址与地址栏中显示的完全一致.
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.
- 将 127.0.0.1 = mydevserver.example.com 编辑到您的/etc/hosts 中
- 使用网址缩短器(例如 goo.gl)为 localhost 创建别名
不过,我相信现在可以在Google API 控制台.
However, I believe that it is now possible to configure localhost in the Google api console.
这篇关于Drive API 的 Google API OAuth 不起作用.获取错误:origin_mismatch的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!