-
Notifications
You must be signed in to change notification settings - Fork 0
Janrain Engage
RPX is a OpenID based login system for websites ([url]https://rpxnow.com/[/url]). I have created a CodeIgniter Library for RPX 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 RPX 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 RPX controller (which can be 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 RPX 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 RPX 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.
For comments, questions, or whatever please visit the forum thread. [url]http://codeigniter.com/forums/viewthread/142816/[/url]
[b]Library Download: File:RPX Login.zip[/b]