【发布时间】:2016-07-19 14:22:52
【问题描述】:
不敢问这个问题,因为我无法为它创建一个 jsfiddle,但希望有人能提供帮助。
我正在尝试在 ColdFusion 中为 Instagram 登录创建一个 cfc。那部分已经完成。我正在使用邮递员(谷歌应用程序),通过我的凭据,我可以在 json 中看到用户的数据,但是当我将其转换为 ColdFusion 时,它会出错。我尝试更改数据类型、标题和很多行,但仍然一次又一次地遇到相同的错误。
我的代码(为安全起见,将 id 替换为 xxx)
<cftry>
<cfhttp url="https://api.instagram.com/oauth/access_token" method="post" resolveurl="yes">
<cfhttpparam type="header" name="Content-Type" value="application/x-www-form-urlencoded" />
<cfhttpparam type="formfield" name="client_id" value="14faxxxxxdc5440f86x6cdd8xxxxf78" />
<cfhttpparam type="formField" name="client_secret" value="40xa78220cfb" />
<cfhttpparam type="formField" name="grant_type" value="authorization_code" />
<cfhttpparam type="formField" name="redirect_uri" value="#URLEncodedFormat('http://example.com/demo/instagramAPI/success.cfm')#" />
<cfhttpparam type="formField" name="code" value="#url.code#" />
</cfhttp>
<cfdump var="#cfhttp#"><cfabort>
<cfcatch type="any">
<cfdump var="#cfcatch#">
</cfcatch>
</cftry>
我正在关注answer 中的这段代码。有关更多信息,请查看此。您可以看到我使用相同的登录详细信息获取数据,但通过 cfc 执行相同操作时出现错误。
我已经阅读了很多文章和博客,但仍然无法解决错误。谁能帮我理解我做错了什么?如果您有任何其他建议,请告诉我。
如果需要任何其他信息,请告诉我。
【问题讨论】:
-
你试过没有
cfhttpparam type="header"吗? -
是的,我做了同样的错误..没有变化
-
<cfhttpparam type="formFiexxxxxxxxxxxxxxxxxxxxld"? -
我正在尝试更改个人 ID,我想我在这样做的时候做到了.. 它只是在创建问题时出现拼写错误,因为无法共享办公室的个人详细信息所以..
-
由于您正在与 instagram API 建立 SSL/TLS 连接,您是否已将他们的证书安装到您的 ColdFusion 服务器的密钥库中?此外,尝试从 ColdFusion 服务器本身连接到该 URL,但不要使用 ColdFuison。打开服务器上的浏览器,看看您是否可以访问该 URL 或您看到什么错误。
标签: coldfusion instagram instagram-api