CakePHP and OpenID

I got the chance to integrate OpenID authentication into a CakePHP application that I am working on. I tried the OpenID component at first but kept running into troubles with the return_url not matching what was expected. After getting no where for a couple of hours, I found a simpler library to use – the LightOpenID library.

All I had to do was to load it using App::import('Vendor','openid'); and that was it.

The library is pretty straight forward to use and even the examples given were more than enough to get it working. However, I ran into another problem very quickly. Some OpenID worked while others did not. After some investigation, it turned out that it was due to the use of mod_rewrite that caused a url to have two “?” in it. To fix this problem, I forced the return_url to have a “?” in it that made the OpenID provider use a “&” instead.

That was it!

So, the return_url was something like:

Published by

Shawn Tan

Chip Doctor, Chartered Engineer, Entrepreneur, Law Graduate.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s