-
Notifications
You must be signed in to change notification settings - Fork 0
Janrain Engage
Janrain Engage (RPX) is a OpenID based login system for websites ([url]http://www.janrain.com/products/engage[/url]). 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 ([url]https://rpxnow.com/examples/RPX.php[/url]) and the OpenIDRpx Library ([url]http://codeigniter.com/wiki/OpenIDRpx/[/url]).
This library requires PHP 5, JSON, and cURL to function. It also requires that Query Strings are enabled as Engage passes the token to your token url via query strings. For help with Query Strings see this forum thread: [url]http://codeigniter.com/forums/viewthread/142818/[/url]
This library is very easy to use. Here is a basic Engage controller (which is used as the token URL).
[code] function index(){ if($this->input->get('token')){ // Send token to RPX Library $this->rpxlogin->token($this->input->get('token')); $response = $this->rpxlogin->authinfo();
// Save info into session
$this->session->set_flashdata('rpxlogin', $response['profile']);
// Load up user system
redirect('/users/rpxlogin');
}
} [/code]
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.
[b]Library Download: File:JanrainEngage.zip[/b]