我想使用下面的代码发布。我期望它返回令牌,但返回错误405方法不允许。谷歌oauth令牌给405错误
<cfhttp method="POST" url="http://accounts.google.com/o/oauth2/token" >
<cfhttpparam type="Formfield" name="code" value="#url.CODE#">
<cfhttpparam type="Formfield" name="client_id" value="458381219741.apps.googleusercontent.com">
<cfhttpparam type="Formfield" name="client_secret" value="XXXXXXX">
<cfhttpparam type="Formfield" name="redirect_uri" value="http://console.mbwebportal.com/oauth2callback">
<cfhttpparam type="Formfield" name="grant_type" value="authorization_code">
</cfhttp>
上面的代码是http://console.mbwebportal.com/oauth2callback连带代码URL中的用户允许访问该应用程序后。
请帮忙!!
你不应该在你的请求中使用HTTPS协议?来自Google的https://developers.google.com/accounts/docs/OAuth2WebServer页面:“此请求是HTTP邮件,并包含以下参数...” – azawaza
没有https给出其他错误(如未找到页面)。它必须是根据谷歌文档的HTTP 1.1请求,它会自动调用https地址。尝试在浏览器中粘贴http://accounts.google.com/o/oauth2/token,您会看到它转换为https。 –