3
我正在尝试将ColdFusion与Google+集成。我遇到grantType
问题。首先,我使用Google对用户进行了身份验证。然后,当我试图获取令牌时,会抛出错误。下面是我的代码:谷歌登录与ColdFusion集成
<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>
这是错误:
{ "error" : "invalid_request", "error_description" : "Required parameter is missing: grant_type" }
什么我错在这里做什么?我没有看到问题。请帮忙。
我跟了这https://developers.google.com/identity/protocols/OAuth2WebServer
非常感谢@亚历山大。 –