Project: An lightweight, easy to use PHP5 OpenID library.

Recently, I wanted to add OpenID authentication support to a website I was coding. Therefore I needed a library to handle that.

What I wanted was simply an library that wouldn't generate any kind of errors (including strict ones), and would support both version of OpenID. However, I haven't found any. Of course I have searched at openid.net, which lists all of the libraries that I've tested.

But I still wanted the functionality. So I wrote my own library -- LightOpenID. It works only as a client, as I didn't need to be an OP.
Features:

  • Is easy to use! (you can code a functional client in less than ten lines of code!)
  • Depends only on curl
  • Supports both OpenID 1.1 and 2.0
  • Supports Yadis discovery
  • Supports only stateless/dumb protocol
  • Works with PHP >= 5
  • Generates no errors with error_reporting(E_ALL | E_STRICT)
  • Small -- only one file, one class, and 340 lines of code.

You can get the code at http://gitorious.org/lightopenid

Comments:
Hi Mewp First of all, thanks for putting effort into your OpenID library. It is a lot easier to implement, compared to other libraries! I'm having problems with some OpenID servers though, more specific with your discover() function. AOL for example, does not return info like "openid_identity" as a GET variable, but as a POST variable. Because of this, I'm getting an ErrorException('No identity supplied.'), even though I logged in successfully. I tried to change it myself, but ended up changing a lot of code, and it's still not working as expected. Maybe you have a simple solution for this? If you need more info on what exactly is going wrong, please ask. Greetings Ben
Grozzy wrote:
Hi Mewp! The library works great! I can authenticate to almost all providers. The only thing, and I'm not an expert, is that I don't know how to fetch the account data from the provider. I can't get it to work! Greetings Grozzy
Grozzy wrote:
And then I keep getting this all the time: Fatal error: Uncaught exception 'ErrorException' with message 'No servers found!' in /customers/fuskbay.se/fuskbay.se/httpd.www/chancom/openid.php:281 Stack trace: #0 /customers/fuskbay.se/fuskbay.se/httpd.www/chancom/openid.php(387): LightOpenID->discover('http://yahoo.co...') #1 /customers/fuskbay.se/fuskbay.se/httpd.www/chancom/index.php(8): LightOpenID->authUrl() #2 {main} thrown in /customers/fuskbay.se/fuskbay.se/httpd.www/chancom/openid.php on line 281
@Grozzy: you need to use http://me.yahoo.com as OpenID url.
Mewp wrote:
@Ben: Writing help requests in comments here is a bad idea. You'd get much faster response if you'd just message me at gitorious or sent me a mail. I didn't know that any OP used POST. Thanks for pointing it out. I'll probably just change $_GET's to something else ($_REQUEST would probably work, but in some cases it won't).
Name:
Website (not required):
Text: