我正在尝试将 ColdFusion 与 Google+ 集成。我遇到了问题grantType。首先,我使用 Google 对用户进行了身份验证。然后当我尝试获取令牌时,它会抛出错误。下面是我的代码:
<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>
Run Code Online (Sandbox Code Playgroud)
这是错误:
{ "error" : "invalid_request", "error_description" : "Required parameter is missing: grant_type" }
Run Code Online (Sandbox Code Playgroud)
我在这里做错了什么?我没有看到问题所在。请帮忙。
我已经关注了这个https://developers.google.com/identity/protocols/OAuth2WebServer
嗨,我已经使用原始javascript DOM创建了一个dom:
Javascript代码:
var parentElm = document.createElement("div");
var child1 = document.createElement("p");
var child2 = document.createElement("p");
parentElm.id = "parent";
child1.id = "child1";
child2.id = "child2";
child1.innerHTML = "Hello";
child2.innerHTML = "world"; // Is it a good way
parentElm.appendChild(child1);
parentElm.appendChild(child2);
document.body.appendChild(parentElm);
Run Code Online (Sandbox Code Playgroud)
生成的HTML是:
<div id="parent">
<p id="child1">Hello</p>
<p id="child2">World</p>
</div>
Run Code Online (Sandbox Code Playgroud)
现在当我想删除上面的部分时,我会做如下.
document.body.removeChild(parentElm);
Run Code Online (Sandbox Code Playgroud)
在这里我害怕javascript内存泄漏.
请帮助我在javascript dom操作.
我来自PHP背景,对ColdFusion来说很新.我正在使用ColdFusion-10
我创建了两个文件:cfm文件和cfc文件.当我在cfm文件中使用cfquery执行查询时,它正在工作.但是当我在cfc文件中执行相同的操作并调用cfm文件中的函数时,它会抛出一个错误,说表名不存在.
两个文件中的cfquery:
<cfquery name="test" dbtype="query">
SELECT * FROM tbl_name
</cfquery>
Run Code Online (Sandbox Code Playgroud)