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

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

问题描述

由于我无法为其创建jsfiddle,因此希望有人能够帮助您。



我试图创建一个cfc在ColdFusion的instagram登录。这部分完成。我使用postman(谷歌app)和凭据我可以看到用户的数据在json,但是当我把它转换为ColdFusion它给出一个错误。我尝试改变数据类型,头和很多行,但仍然得到相同的错误一次又一次。



我的代码)

 < cftry> 
< cfhttp url =https://api.instagram.com/oauth/access_tokenmethod =postresolveurl =yes>
< cfhttpparam type =headername =Content-Typevalue =application / x-www-form-urlencoded/>
< cfhttpparam type =formfieldname =client_idvalue =14faxxxxxdc5440f86x6cdd8xxxxf78/>
< cfhttpparam type =formFieldname =client_secretvalue =40xa78220cfb/>
< cfhttpparam type =formFieldname =grant_typevalue =authorization_code/>
< cfhttpparam type =formFieldname =redirect_urivalue =#URLEncodedFormat('http://example.com/demo/instagramAPI/success.cfm')#/>
< cfhttpparam type =formFieldname =codevalue =#url.code#/>
< / cfhttp>
< cfdump var =#cfhttp#>< cfabort>
< cfcatch type =any>
< cfdump var =#cfcatch#>
< / cfcatch>
< / cftry>

我从这。您可以看到我通过使用相同的登录详细信息获取数据,但当通过cfc执行相同操作时,我收到错误。



错误运行网址后:



我阅读了很多文章和博客,但仍然无法解决错误。任何人都可以帮助我明白我做错了什么?如果您有任何其他建议,请告诉我们。



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



我做的是更新我的SSL证书。我之前尝试过,但没有太多的信息,如组织单位等,但后来我按照链接,由Miguel提供并测试,然后我得到了过期代码错误。



之后,我试图刷新与reinit = 1,在更新证书后忘记重新初始化,然后我得到结果:)



SO最终答案是更新您的SSL证书



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



如果任何人有问题Instagram cfc然后让我知道..我花了几天的时间,可以帮助你..)


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

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.

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>  

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.

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.

解决方案

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

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.

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

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

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

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

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

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