The OpenID idea is great, save the hassle for user to register before they can start using the page, the idea is like using existing OpenID supported provider, like Google, Yahoo, Windows Live, etc to login to OpenID supported site and start using the site.

With RPX, they provide developer and easy to use services, the paid services with handy API is rather expensive, but the basic one do well for most of the time. After registered the basic account, we’ll have 6 slots for providers, some provider required us to setup on their site first, like Facebook, we need to create an application, so do Twitter, as for Windows Live, we need to setup and Live Services on Azure.

All the login interface is taking care by RPX script, which we can get it from their site, is few lines of JavaScript that put on our page’s HTML. What we need to do is to trap the post data token returned after user successfully logged in through the provider. In C#, can do it this way, for the sake of example:

protected void Page_Load(object sender, EventArgs e) {  
  if (Request["token"] != null) {
    //now we get the token needed for our POST call
  }  
}  

Because I’m using the free package, so I don’t have access to nice API call, what I can do is to retrieve the basic information from the provider, using this https://rpxnow.com/api/v2/auth_info?apiKey=&token=&format=xml. The apiKey is the key we get to identify the RPX account we are using, and we can get the apiKey after registered an account. Token is the key retrieved from the POST data after the user logged in using their selected provider. By default, the RPX return us result in JSON format, I’m not familiar with it, so I pass in format=xml to ask RPX return me in XML format.

To call the POST in .net:

WebRequest wRequest;  
Stream stream;  
StreamReader streamReader;  
WebResponse wResponse;

string response = "";  
string url = "https://rpxnow.com/api/v2/auth_info?apiKey=";
string api = "someAPIKey";  
wRequest = WebRequest.Create(url + api + "&token=" + token + "&format=xml");  
wResponse = wRequest.GetResponse();  
stream = wResponse.GetResponseStream();  
streamReader = new StreamReader(stream);  
response = streamReader.ReadToEnd();  

and we’ve get the result in XML format!

There are few info we can get from the call, like username, provider name, the identifier for the provider, photo (if applicable), name, family name , phone and others depends on which provider, some data is common for all (I’m not yet tested all) provider.

Happy logging in and logging out~