Hello All, We had a requirement where I was asked to Integrate Janrain with Adobe CQ.
If you don’t know what janrain is? please go through this site http://janrain.com/. I used Engage to Integrated Social Login into my Website.
Integration by Steps:
1. Create an account in Janrain website. Link provided above.
2. After logging in, you will have many widgets, which contains social networking sites embedded into the widgets.
3. Janrain will guide through the widget selection procedure.
4. Once you select your widget, Janrain will provide you a script, which you need to include in head section. (head.jsp in the page component)
5. Janrain will also provide a <div id=”<value>”></div> which should be included where you want the social networking icons to appear on your page. (may be in a component jsp).
6. In the script which janrain provides, you need to give a token url, where you will the login token as a post request.
– I created a servlet and provided the servlet path (full path with domain, e.g., http://localhost:4502/servletpath) in the place holder provided for token url in the script.
– – One more important task is to allow the host which sends you the token. To do this, you need to open system console (/system/console) and go to configuration tab, click on Apache Sling Referer Filter, in the dialog remove the POST parameter from the multifield (delete by clicking “-“), and add your host url (provided by janrain when you login) in the Host field. if you miss this step, then you will get access forbidden error.
– In the servlet, retrieve the token by request.getParameter(“token”). Once you retrieve the token, you can make an API call to Janrain to get the user’s social networking details by using the Token, API key (provided when you login).
– Use this class as a reference to call API – https://github.com/janrain/Janrain-Sample-Code/blob/master/java/java-helper-class.java
– Once you make the API call, you will get the user details in the form of JSON/XML. Parse the JSON response and make use of user details for logging in.
I hope this post is helpful. Let me know in case of questions. Thanks!
Leave a comment