如何解决Google Buzz API-无法解决错误:“缺少必填参数-grant_type”
|| 我正在尝试使用python创建一个桌面应用程序以将消息发布到Google Buzz。我无法与access_token交换代码(我要求用户在授权应用程序后从浏览器复制粘贴的代码)。 我正在通过以下方式对www.google.com4 / accounts / o8 / oauth2 / token进行POST:send: \'POST /accounts/o8/oauth2/token HTTP/1.1\\r\\nHost: www.google.com\\r\\nAccept-Encoding: identity\\r\\nContent-Length: 194\\r\\n\\r\\nclient_id=XXXXXXX.apps.googleusercontent.com&client_secret=XXXXXXXXXXXXXX&code=4/JFxWkTynH63BruP_dLqtJTV0O_oc&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob\'
reply: \'HTTP/1.1 400 Required parameter is missing: grant_type\\r\\n\'
header: Cache-Control: no-cache,no-store,max-age=0,must-revalidate
header: Pragma: no-cache
header: Expires: Fri,01 Jan 1990 00:00:00 GMT
header: Date: Mon,30 May 2011 09:04:36 GMT
header: Content-Type: text/html; charset=UTF-8
header: X-Content-Type-Options: nosniff
header: X-Frame-Options: SAMEORIGIN
header: X-XSS-Protection: 1; mode=block
header: Server: GSE
header: Transfer-Encoding: chunked
400 Required parameter is missing: grant_type
<HTML>
<HEAD>
<TITLE>Required parameter is missing: grant_type</TITLE>
</HEAD>
<BODY BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\">
<H1>Required parameter is missing: grant_type</H1>
<H2>Error 400</H2>
</BODY>
</HTML>
更具体地说,我以这种方式发送参数(复制,粘贴,从上面格式化):
POST /accounts/o8/oauth2/token HTTP/1.1\\r\\n
Host: www.google.com\\r\\n
Accept-Encoding: identity\\r\\n
Content-Length: 194\\r\\n
\\r\\n
client_id=XXXXXXX.apps.googleusercontent.com&
client_secret=XXXXXXXXXXXXXX&
code=4/JFxWkTynH63BruP_dLqtJTV0O_oc&
grant_type=authorization_code&
redirect_uri=urn:ietf:wg:oauth:2.0:oob
有什么想法/建议/指标吗?我该如何解决该错误?我在哪里错了?
感谢您的时间和耐心等待。
最好的祝福,
Srivatsan Iyer
解决方法
[回答我的问题,希望对以后的读者有所帮助]
我设法解决了我的问题。我使用Python的
HTTPSConnection
对上述数据进行了POST。 GAE可能对此不太满意。我改用google.appengine.api.urlfetch
,效果很好! :-)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。