Converting caffeine to code, shooting pics, and cruising the roads of life.

Feb 20th, 2007  Feb 20th, 2007

The future and OpenID

After talking to a few people in #OpenID on last night, I finally decided I was going to get OpenID working with my own custom database library. The only full featured PHP library I could find was the one produced by JanRain. It’s not that I don’t like the features in the library, but the fact that it’s a PEAR style library, so it requires a few other PEAR libs that I absolutely refuse to use due to bloat, specifically PEAR::DB.

This caused a real issue for me. Function names are extremely different, along with how queries are performed, compared to my mysqli library. Sometime last month I tried to make a PEAR-style wrapper for my class, but for some reason it failed with the library. Well, last night I found the WordPress OpenID plugin. Knowing that WP runs it’s own MySQL class, I downloaded it and studied the wrapper. This allowed me to see what I had been doing wrong and get a system working before school started today.

Once I had it working, I wrote a simple class I call EasyOpenID. This class allows me to minimize the amount of code in JanRain’s consumer example to very few lines of code. I’ve decided I was going to release this library, so I converted it to FileStore, which is the default the library ships with, and packed it up. I am going to release it here to hopefully get some feedback. If the feedback is good, I will probably continue to expand on the class.

I will have a page up for the library later on tomorrow, but for now, download the file located here. This zip file contains the converted consumer example and my class. The class is released under the new BSD license, while the rest of the code is GPL. Please, provide me with any of your thoughts on the library. Even if you don’t use it on a real, live site, please just let me know what you thought.

Talking with the folks in #OpenID also got me invited to be on the first official OpenID podcast recording, no idea if I’ll be involved, but I’m listening. You will be able to obtain the podcast on sometime tomorrow night or on Thursday. I hope all goes well. Hopefully this new podcast will provide a great resource for developers looking to learn and expand on OpenID.

29 Responses to “The future and OpenID”

  1. Dragoniz3r says:

    Cody, you’re a dumb piece of shit :P
    Really, I don’t think that, I just wanted to give you some traffic ;)

  2. Alex K says:

    Thanks for the hint a question though….

    if I dont have an iPhone connected (for test purposes) what output should I get from running tool?

    I currently get permission denied is this correct?


  3. Tobias says:

    Warning: require_once(Auth/OpenID/Consumer.php) [function.require-once]: failed to open stream: No such file or directory in

    Does anyone know where to get these files? Can’t find them in the zip…and can’t find it in the documentation.

    Or does anyone know an openphp-library with documentation und which is working? :)

  4. Cody Mays says:

    You need to download the the PHP-OpenID library from My class just makes it easier to use.

  5. Kris says:

    I’m having a slight problem, I’m getting directed to my provider, authenticating, then back again but get the following error:
    Fatal error: return_to must be a string; see NEWS file for upgrading notes. in /home/.peony/krisnorthfield/ on line 409

    I’ve tried several things to no avail. Any clues?

  6. Ozmo Camaris says:

    Kris, to correct your issues and the next one you’ll get after you correct that one ;) try this:

    Line 77 REMOVE
    $this->response = $consumer->complete($_GET);
    Line 77 ADD
    $return_to = substr($_GET['openid_return_to'], 0, strpos($_GET['openid_return_to'], "?"));
    $this->response = $consumer->complete($return_to);

    Line 37 REMOVE
    $sreg = $response->extensionResponse('sreg');
    Line 37 ADD
    $sreg = $response->extensionResponse('sreg', true);

    Note: The $return_to line in EasyOpenID.php is one line, but the blog cuts it off, make sure you don’t have a stray carriage return.

  7. tops says:

    in, I get the following error:
    Fatal error: Define Auth_OpenID_RAND_SOURCE as null to continue with an insecure random number generator. in C:\AppServ\www\php-openid\Auth\OpenID\CryptUtil.php on line 52

    and in
    I get the following error:
    Authentication Error.

  8. Rakesh Rawat says:

    Warning: require_once(Auth/OpenID/Consumer.php) [function.require-once]: failed to open stream: No such file or directory in

    Does anyone know where to get these files? Can’t find them in the zip…and can’t find it in the documentation.

    Or does anyone know an openphp-library with documentation und which is working? :)

  9. x-f says:

    Hi, Cody!
    Your PHP class looks much a lot lighter than the JanRain’s original, so I was considering to use it in my project.
    However I ran into a small problem – simple registration extension (sreg) doesn’t work.
    In request params there’s this:
    [openid_ext0_optional] => email
    [openid_ns_ext0] =>

    But it should be:
    [openid_sreg_optional] => email
    [openid_ns_sreg] =>

    And I can’t find, where does this “ext0″ come from.
    The original /consumer works fine, EasyOpenID not.
    Could you, please, take a look?

  10. Jay Stockman says:

    I get the following error

    Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in /var/www/vhosts/ on line 8


  11. Robbie says:

    I get the same error as Jay

  12. kelvin says:

    when i add! it stated need url2.0 and for this onl 1.1

  13. colorful nick says:

    Hey there,

    you’re writing that you’ll add the script to the library – meanwhile we can use the direct link to v1.0. Now that this article is quite old, I wonder where the library is, to see if this direct link is outdated or not.

    feel free to answer me via mail, if you find the time. Thanks,

  14. Cody Mays says:

    You are correct, this library is slightly outdated. I have not been keeping it updated unfortunately :/. If someone would like to, feel free to email me.

  15. branditurner says:

    i need to login to my yahoo account by useing openid

  16. Hi, this weekend is fastidious in support of me, for
    the reason that this occasion i am reading this enormous informative post here at
    my residence.

  17. Hey very interesting blog!

    Here is my web blog: Bankruptcy Attorney

  18. Hey, is it still a working module to implement it with modern sites to simply OID login customers?

  19. Oliver says:

    Interesting lib. It is still usable or completely outdated?

  20. It’s amazing to pay a quick visit this web page and reading the views of all friends regarding this paragraph,
    while I am also keen of getting know-how.

    my blog :: Stainless Steel sink

  21. very good article I agree with you I will follow you a lot of compliments

  22. Although in the end you can build an object oriented site on top of Word
    - Press just like you can with any other framework.
    There are two functions that needs to use and they are:.
    The web development industry constantly shifting
    towards PSD to Word – Press conversion.

  23. Crate Residence, built by Allan Wexler in 1990, is a residence in an eight-toes dice and 4
    crates. This home examines our current life as if historical.
    Every crate has its very own perform and is therfore isolated
    and examined: kitchen, lavatory, dwelling area and
    bedroom. When one particular function is necessary that crate
    is rolled inside the main. At evening the complete
    home gets a bed room and when the occupant is hungry the whole home gets a kitchen.
    The simple activities are pared down to essential artifacts needed and sought after.
    Isolated they are sculpture, their use turns into theater. As
    Wexler describes: He’s more intrigued in the soreness and he wants to try
    to make men and women think two times, to restate, to stand back, as effectively as
    to seem closely.

Leave a Reply