2
我想在python中創建一個桌面應用程序來發送消息到Google Buzz。我無法使用access_token來交換代碼(我要求用戶在授權應用程序後從瀏覽器複製粘貼)。Google Buzz API - 無法解決錯誤:「必需的參數丟失 - grant_type」
我做一個POST到www.google.com4 /帳號/ O8 /的oauth2 /令牌方式如下:
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艾耶