4

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 answer. For more info check this Image. 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 : Error

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.

Community
  • 1
  • 1
Leo the lion
  • 3,213
  • 2
  • 19
  • 39
  • Did you try with out the `cfhttpparam type="header"`? – rrk Mar 31 '16 at 08:58
  • yes i did and same error..no change – Leo the lion Mar 31 '16 at 09:24
  • i was trying to change personal id and i think i did while doing that.. it just typo error while creating question as can't share personal details of office so.. – Leo the lion Mar 31 '16 at 09:40
  • Since you are making an SSL/TLS connection to the instagram API, have you installed their certificate into your ColdFusion server's keystore? Also, try connecting to that URL from the ColdFusion server itself but not using ColdFuison. Open a browser on the server and see if you can get to that URL or what errors you see. – Miguel-F Mar 31 '16 at 11:56
  • Server returned is "proxygen" - is that the same server returned from the browser? Are you hitting something in the middle perhaps? – Mark A Kruger Apr 01 '16 at 20:37
  • @Miguel-F, M new bee with coldfusion server so asked my senior to install the certificate into server.. On monday he will then will tell you the result. – Leo the lion Apr 02 '16 at 12:16
  • @MarkAKruger, Not getting the point of yours?? I think i must have issue with certificate. – Leo the lion Apr 02 '16 at 12:16
  • @Miguel-F, can you please tell me how can i install the certificate in my coldfusion server? tried to read on net but did not get anything yet. – Leo the lion Apr 04 '16 at 07:18
  • These instructions are still good I believe. http://www.coldfusionmuse.com/index.cfm/2005/1/29/keystore – Mark A Kruger Apr 04 '16 at 17:55
  • i already tried this mark..and a lot links too but same result..did all these then started even bounty but no result :( – Leo the lion Apr 05 '16 at 05:29
  • and m not able to install the certificate on server as i don't have proper credentials from certificate like Organization, organization unit etc.. – Leo the lion Apr 05 '16 at 05:30
  • Sorry Leo I have been out of town til now. Try these instructions that I provided on another question - http://stackoverflow.com/a/20475763/1636917 to install the certificate. You **MUST** be sure to install the certificate into the correct keystore that is being used by ColdFusion. – Miguel-F Apr 07 '16 at 12:19
  • Its ok and thank you for your comment..trying the instruction now and will let you know what happened. – Leo the lion Apr 07 '16 at 12:23
  • @Miguel-F, please post your answer as your comment helped me. thank you – Leo the lion Apr 11 '16 at 07:28
  • No need as you have already posted your solution. Glad you got it working! – Miguel-F Apr 11 '16 at 21:57

1 Answers1

3

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

Community
  • 1
  • 1
Leo the lion
  • 3,213
  • 2
  • 19
  • 39