Sample Code for Janrain integration for CFML / ColdFusion

Here is a sample code for integration the Janrain Engage social login. This is inspired by the sample codes published over at https://github.com/janrain/Janrain-Sample-Code. (I asked them to integrate the CFML sample code, but they did not reply) Alas, you find the code below or can also get it on Github as well at https://github.com/thenitai/ColdFusion-Janrain-Sample-Code.
[coldfusion]<!— This code sample shows how to make the auth_info API call using CFML —>
<!— Enter your API key here —>
<cfset variables.apikey = "">
<!— Step 1) Extract the token from your environment —>
<cfset variables.token = form.token>
<!—
Step 2) Now that we have the token, we need to make the api call to auth_info.
auth_info expects an HTTP Post with the following paramters:
—>
<cfhttp url="https://rpxnow.com/api/v2/auth_info">
<cfhttpparam name="token" value="#variables.token#" type="URL">
<cfhttpparam name="apiKey" value="#variables.apikey#" type="URL">
</cfhttp>
<!— If status code is 200 —>
<cfif cfhttp.responseheader.status_code EQ "200">
<!— Step 3) read the json response —>
<cfset variables.auth_info_json = Deserializejson(cfhttp.filecontent)>
<!— Set default variables which might be in the response (depending on the provider) —>
<cfparam name="variables.auth_info_json.profile.displayName" default="" />
<cfparam name="variables.auth_info_json.profile.email" default="" />
<cfparam name="variables.auth_info_json.profile.photo" default="" />
<!— Step 4) use the response to sign the user in —>
<cfif variables.auth_info_json.stat EQ "OK">
<!—
‘identifier’ is the unique idenfifier that you use to sign the user in to your site
—>
<cfset variables.identifier = variables.auth_info_json.profile.identifier>
<!—
get fields
—>
<cfset variables.displayName = variables.auth_info_json.profile.displayName>
<cfset variables.email = variables.auth_info_json.profile.email>
<cfset variables.profile_pic_url = variables.auth_info_json.profile.photo>
<cfset variables.providerName = variables.auth_info_json.profile.providerName>
<cfset variables.preferredUsername = variables.auth_info_json.profile.preferredUsername>
<!—
actually sign the user in. this implementation depends highly on your platform, and is up to you.
—>
<!— <cfinvoke component="" method=""></cfinvoke> —>
<!— Simply dump variables —>
<cfdump var="#variables#">
<!— Error with Authentication —>
<cfelse>
<h1>Error with the authentication</h1>
<cfdump var="#variables.auth_info_json.err.msg#">
</cfif>
<!— There is an error with the http response —>
<cfelse>
<h1>Error with the HTTP Response</h1>
<cfdump var="#cfhttp#">
</cfif>[/coldfusion]

Why Coldfusion / CFML has its place and is worth to learn it
I actually never indulge in conversations why one programming language is better then another, because what is right to you, does not automatically mean, it is right for someone else. So, for me ColdFusion, or as we call the language itself - CFML, works very well. Nevertheless, in this post…

OpenBD and MongoDB: Can't get easier then this
I'm currently working on a project that uses MongoDB (yes, that's the awesome NoSQL database everyone talks about). Now, my favorites language of choice (CFML) and especially my favorite open source CFML engine OpenBD, has support for MongoDB built in which makes it a snap to use for any ColdFusion…

CFML and Cannot run program "chmod": java.io.IOException: error=24, Too many open files
Migrating one of my customers the other day, bought up an ugly error when I had to create 2000 directories on one go. The error was: [code]Cannot run program "chmod": java.io.IOException: error=24, Too many open files[/code] While, "too many open files" usually means one can raise the limit of open…

Setting the correct Java version under MacOS X
My favorite scripting language is CFML, or as some know it as ColdFusion. I like it because it is very very powerful, easy to use and can do just about everything your xyz language can do. For many years, ColdFusion was a closed sourced system, where the former Macromedia and…

Razuna Digital Asset Management module for Drupal
Sometimes here at Razuna, we’re reminded of why we offer open source digital asset management to people around the world. And this week, was one of those wonderful occasions. We received an email from Mandar Harkare, who told us that he had developed a Dupal module for Razuna. He even…