Archive

Posts Tagged ‘openid’

OpenID and Prairie

December 17th, 2008

OpenID is a distributed single sign-on scheme: instead of having a different username for every site you want to use, you have a single username that can be used to log in to all OpenID-enabled sites. I recently installed an OpenID provider, Prairie, to http://aidan.aidanfindlater.com/. Prairie looks near-perfect, being PHP/MySQL-based and easy to install so that just about anyone can run their own OpenID provider. (It’s like the Wordpress of OpenID!)

However, I soon ran into a problem: it wouldn’t allow me to log in to xmind.net (mind-mapping software I wanted to play with). I know it works elsewhere, so what was different? Well, it turns out that xmind.net uses a POST to pass in the requisite OpenID variables, while other services use a GET with a query string. Prairie was not set up to handle this, and fails to redirect to the appropriate URL after authenticating.

Solution? I inserted the following into login.php, just under the opening comment:

if (isset($_POST['openid_mode'])) {
        header('location: /trust?' . http_build_query($_POST));
        exit;
}

Now, if it gets a POSTed request, it simply rewrites the POST as a GET and away we go!

Aidan Findlater Impersonal ,