Google登录与ColdFusion的集成

Google登录与ColdFusion的集成,coldfusion,oauth-2.0,coldfusion-10,google-login,Coldfusion,Oauth 2.0,Coldfusion 10,Google Login,我正在尝试将ColdFusion与Google+集成。我的grantType有问题。首先,我使用谷歌认证了一个用户。然后,当我试图获取令牌时,它抛出了一个错误。下面是我的代码: <cfset code = URLEncodedFormat('#code#')> <cfset appId = URLEncodedFormat('#this.appId#')> <cfset key = URLEncodedFormat('#this.key#')> <

我正在尝试将ColdFusion与Google+集成。我的
grantType
有问题。首先,我使用谷歌认证了一个用户。然后,当我试图获取令牌时,它抛出了一个错误。下面是我的代码:

<cfset code  = URLEncodedFormat('#code#')>
<cfset appId = URLEncodedFormat('#this.appId#')>
<cfset key   = URLEncodedFormat('#this.key#')>
<cfset uri   = URLEncodedFormat('#this.redirectURI#')>
<cfset grant = 'authorization_code'>  
<cfset postBody = "code=#code#"
                & "&client_id=#appId#"
                & "&client_secret=#key#"
                & "&redirect_uri=#uri#"
                & "&grant_type=#grant#">
<cfhttp url = "https://accounts.google.com/o/oauth2/token" method="POST">
    <cfhttpparam type="body"   value="#postBody#">
    <cfhttpparam type="header" name="Conternt-Type" value="application/x-www-form-urlencoded">
</cfhttp>
我做错了什么?我看不出有什么问题。请帮忙


我遵循了这一点

您想自己构建帖子正文的具体原因是什么?为了安全起见,请尝试以下方法(替换代码段的所有行):


非常感谢@Alexander。
{ "error" : "invalid_request", "error_description" : "Required parameter is missing: grant_type" }
<cfhttp method="POST" url="https://accounts.google.com/o/oauth2/token">
    <cfhttpparam type="formfield" name="grant_type"     value="authorization_code">
    <cfhttpparam type="formfield" name="redirect_uri"   value="#this.redirectURI#">
    <cfhttpparam type="formfield" name="client_id"      value="#this.appId#">
    <cfhttpparam type="formfield" name="client_secret"  value="#this.key#">
    <cfhttpparam type="formfield" name="code"           value="#code#">
</cfhttp>