错误 400:通过 Coldfusion 从 instagram api 获取 json 数据时出现错误请求 [英] Error 400: Bad request while fetching json data from instagram api via coldfusion

查看:26
本文介绍了错误 400:通过 Coldfusion 从 instagram api 获取 json 数据时出现错误请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不敢问这个问题,因为我无法为它创建一个 jsfiddle,但希望有人能提供帮助.

Afraid to ask this question as I'm not able to create a jsfiddle for it, but hope someone will be able help.

我正在尝试在 ColdFusion 中为 Instagram 登录创建一个 cfc.那部分已经完成.我正在使用邮递员(谷歌应用程序),通过我的凭据,我可以在 json 中看到用户的数据,但是当我将其转换为 ColdFusion 时,它会出错.我尝试更改数据类型、标题和很多行,但仍然一次又一次地收到相同的错误.

I'm trying to create a cfc in ColdFusion for an instagram login. That part is done. I'm using postman (google app) and by my credentials I can see the user's data in json, but when I'm converting this into ColdFusion it's giving an error. I tried to change the data-type, header and a lot of lines but am still getting the same error again and again.

我的代码(为安全起见,将 id 替换为 xxx)

My code (replaced ids with xxx for security)

<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>  

我正在关注此.您可以看到我使用相同的登录详细信息获取数据,但通过 cfc 执行相同操作时出现错误.

I'm following this code from this . You can see that I'm getting data by using the same login details, but when doing the same via a cfc I'm getting error.

运行 url 后出现的错误:

Error which I'm getting after running the url :

我已经阅读了很多文章和博客,但仍然无法解决错误.谁能帮我理解我做错了什么?如果您有任何其他建议,请告诉我.

I've read a lot of articles and blogs, but still haven't been able to resolve the error. Can anyone help me understand what I'm doing wrong? If you have any other suggestions, please do let me know.

如果需要任何其他信息,请告诉我.

If any additional information is required, just let me know.

推荐答案

几天后我终于得到了我的问题的答案.谢谢 Miguel-F 和 Mark A Kruger 但是 Mark your link was not good for me as that was出于我的问题所以..

Finally i got the answer of my question after days.. Thanx Miguel-F and Mark A Kruger however Mark your link wasn't good for me as that was out of my issue so..

我所做的是更新我的 SSL 证书.我之前尝试过,但没有太多信息,如组织单位等,但后来我按照 Link,由 Miguel 提供并经过测试,然后出现过期代码错误.

What i did is to update my SSL certificate. I tried before but was not having much information like Organization unit etc but then i followed the steps given in this Link, provided by Miguel and tested then i got expiration code error.

之后我尝试使用 ?reinit=1 刷新,因为我在我的 cfc 中进行了更改,但在更新证书后忘记重新初始化,然后我得到了结果 :)

After that i tried to refresh with ?reinit=1 as i made changes in my cfc but forget to reinitialize after updating the certificate, and then i got the result :)

所以最终的答案是更新您的 SSL 证书,使用适当的授权,cfc 可以从 Instagram 获取数据..

SO final answer is Update your SSL certificate with proper authorization and cfc can fetch data from Instagram..

链接对我有用一个, CFC 演示.在 cfc 演示中,您可以下载适用于 instagram 的 cfc,这也很有用(即使您不必更新 SSL 证书).

Link useful for me One, CFC demo. In cfc demo you can download the cfc for instagram which is also useful (even in case you don't have to update the SSL certificate).

如果有人对 Instagram cfc 有任何疑问,请告诉我.我在这方面花了几天时间,可以帮助你.:)

If anyone having issue with Instagram cfc then do let me know.. I spent days on this and can help you.. :)

这篇关于错误 400:通过 Coldfusion 从 instagram api 获取 json 数据时出现错误请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆