Janrain Engage

Derek Jones edited this page Jul 5, 2012 · 11 revisions
Clone this wiki locally

Janrain Engage (RPX) is a OpenID based login system for websites ( http://www.janrain.com/products/engage). I have created a CodeIgniter Library for Engage logins (including the mapping functions, which are only available to plus members). It is based on the example code from RPX ( https://rpxnow.com/examples/RPX.php) and the OpenIDRpx Library ( http://codeigniter.com/wiki/OpenIDRpx/).

This library requires PHP 5, JSON, and cURL to function. For this library to work with Codeigniter, you should set the token to be sent to you via POST in the settings on the Janrain site.

This library is very easy to use. Here is a basic Engage controller (which is used as the token URL).

class Engage_login extends Controller{
    function __construct(){

    function index(){
        // Check for token
            //NO TOKEN GIVEN!

        // Send token to RPX Library
        // auth_info API Call
        $response = $this->engage->authinfo();

        // Print out user info (just as an example)

Basically, the token is passed to the library, then the authinfo method is called. That method returns the user's info (as per the Engage API). After that it's up to you. In my example the user's profile is saved in flashdata then the page redirects to the users page.

The library also contains functions to add Engage login to your site. The function embed() will print the HTML for an iframe, and the functions script() and popup() will print the HTML for the JS file and the RPX popup link.

Library Download: File:JanrainEngage.zip