Dope OpenID
This is the home of the Dope OpenID project. After making several updates to the Simple OpenID class, I’ve decided to go ahead and fork the class and rename it for the sake of disambiguation.
Dope OpenID is a PHP class that will allow you to set yourself up as a relying party. This means your users will be able to log in to your website using their OpenID provided by a third-party OpenID provider.
Features:
- Supports PHP 4 and 5
- OpenID 2.0 and lower
- Works with Yahoo, Google, WordPress.com, Technorati, AOL, and many more.
- Open-source and well documented code
- Includes working example script that can be modified and used in your own project
Try out the demo. This could also be useful if you’re unable to authenticate on an OpenID provider and want to verify whether it should be working.
Download Dope OpenID. This includes the Yadis library, which is required to meet OpenID 2.0 specifications (and in order to work with sites like Yahoo, Google, etc.). It also includes the working example script.
You can leave a response, or trackback from your own site.
Subscribe to the feed
Subscribe by email
Thank alot!
I try this on localhost isn’t work.
Error Code: OPENID_NOSERVERSFOUND
Error Description: Cannot find OpenID Server TAG on Identity page.
I just tested on my localhost with no problems. Which OpenID provider are you using when you get this result?
I try demo. But after i login with google account, i don’t see my email. Can we get email by your login via OpenID script?
The simple answer is yes, you should be able to get Attribute Exchange information about the user from Google using this script. After some investigation, it seems if you’re going to ask for user information from Google, it must be specified as “required”. I’ll patch the script and release a new version shortly. Thanks for bringing this to my attention.
Please try again. I’ve made some modifications that should allow this to work properly now. Let me know if you find any problems.
Is not working with Yahoo!
Can you be a little more specific? The demo appears to be working with Yahoo just fine.
great work, I just tested with clamshell and my own server and it works great,
thanks!
jl
Glad you find it useful.
Hi Steve,
I clicked on ‘demo’ link, and I entered my yahoo id after selecting the ‘yahoo’ from drop down and click on ‘sign in with openid’ button.I got the message saying that ‘Error: OpenID Identifier is not in proper format.’.
I am unable to rectify this problem. I entered my login as ****@yahoo.com
Thanks!
Hi, Dev. This is correct. Your OpenID Identifier must be in URL format. In the case of Yahoo, you only need to enter “http://www.yahoo.com” as your login.
Thanks for the release. Nice package. You should make it more easy to configure by creating a variable for URLs (as URLs are hardcoded in the package).
Good work anyway
Thanks for the comment and the idea to make it easier to configure. I’ll see what I can come up with.
Hi, I just tried with yahoo
I log on, have the yahoo warning that I shouldn’t trust this website, log on succesfully, but yahoo didn’t return my email / nuckname / language…
I tested it on your server.
So what’s up? any modification from yahoo?
This is very nice and helpful. Just one question… how secure is this compared to something like http://openidenabled.com/php-openid/ ? Is the responce_nonce mechanism internally implemented in the validateResponse method or do we have to do it ourselves?
Thank you very much
Hi, Sergio. Very good question. Since Dope OpenID is only a relying party, the OpenID 2.0 specifications do not require it to do any validation on the response_nonce, but it is something I plan to implement as a simple time-based check in the next version, which should be released in the next week or two.
Hi Steve, thanks for the reply. I am digging through your code right now. It’s well done and (double thanks) well documented… thanks again, will keep looking for the updates.
There is also one little point I’d like to mention, hope it is useful.
I am writing a wrapper around dope open id for usage in a framework I developed for my company.
The problem is the following:
I include your class (and its dependent files ) from within a static method call.
This works very wll for me but what happens is that:
the variable defined in Services/Yadis/XML.php line 309 gets scoped inside the function where I placed the include. Therefore the function &Services_Yadis_getXMLParser() in Services/Yadis/XML.php line 309 will not find it in the global scope anymore and triggers an error. (I just copied the var definition inside the function for a quick fix)
From what I see the Yadis library has been updated, and the new version fixes this problem, but I didn’t try to replace it in your package.
Thanks again
sergio
I know this is old, but same here. Same mod to make it work as well. Also, around line 135 of ParanoidHTTPFetcher, there’s a foreach headers that blows up because the headers don’t always have the form ‘name: value’. I wrapped it in a if(preg_match(‘/:/’,$header)) as a quick fix, and it works fine now.
Hi, thanks a lot for the application, i’m just testing it, but i can say that’s a lot of useful. =)
Now, let me ask a answer: we can make the script follow redirects? I use a redirect from lyceuhns.net to http://www.lyceuhns.net, but i like to use just lyceuhns.net as id. I saw this works in many sites, but don’t have the minimal idea how to implement.
Thanks for attention. o/
Thanks for keeping up with Simple OpenID. This is exactly what I needed.
I noticed a bug in the class that was preventing it from working with my http://community-id.org account (it’s one of the weird ones that has href before rel in the tag.
A couple of brackets are missing from some of the tag regular expressions.
preg_match_all(‘/]*href=\’”([^\'"]+)[\'"][^>]*rel=[\'"]openid.server[\'"][^>]*\/?>/i’, $content, $matches3);
preg_match_all(‘/]*href=\’”([^\'"]+)[\'"][^>]*rel=[\'"]openid2.provider[\'"][^>]*\/?>/i’, $content, $matches4);
should be
preg_match_all(‘/]*href=[\'"]([^\'"]+)[\'"][^>]*rel=[\'"]openid.server[\'"][^>]*\/?>/i’, $content, $matches3);
preg_match_all(‘/]*href=[\'"]([^\'"]+)[\'"][^>]*rel=[\'"]openid2.provider[\'"][^>]*\/?>/i’, $content, $matches4);
Hello,
I’m attempting to use Dope OpenID for a project but I’m running into some issues. First I’ve noticed the README is for 1.0 and I’m using 1.0.1. Is there an updated readme availible? (If I’m right the only issue is with line numbers so I ignored the old version and continued on as suggested)
When loading up index.php for the first time I got these two errors:
Notice: Undefined index: loggedin in C:\wamp\www\dope\index.php on line 56
Notice: Undefined index: loggedin in C:\wamp\www\dope\index.php on line 58
Welcome, guest!
Log In!
Upon clicking login, I get this error:
Notice: Undefined variable: error in C:\wamp\www\dope\login.php on line 288
(Login toolbar is printed below, the error is printed in red as I see in the source)
After signing in, I get a lot more:
Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\dope\Services\Yadis\XRDS.php on line 295
Notice: Undefined offset: 1 in C:\wamp\www\dope\Services\Yadis\ParanoidHTTPFetcher.php on line 135
Notice: Undefined offset: 1 in C:\wamp\www\dope\Services\Yadis\ParanoidHTTPFetcher.php on line 135
Notice: Trying to get property of non-object in C:\wamp\www\dope\Services\Yadis\XML.php on line 260
I have not attempted to modify the source. If you could reply back with what I need to do to fix this I would really appreciate it.
Hey Steve, I really appreciate what you’ve done but I also want to add facebook to the list for open id login… I am making something similar to http://www.staga.net/Signin …..Can you please help me out…. Thanks in advance
Hey,
Its a great walk through for newbies . We were able to implement 3/4th of it, Unfortunately once the user log in through Open ID which technically should redirect to defined domain page!? which isn’t happening, Need Your help
Really URGENT!
Hi Steve, Thanks for a great effort. I am looking for a openID PHP class to use on http://www.openmail.cc that also supports openID 2.0. I was unfortunately unable to get yours to work. I am using PHP 5.3.0, and there are quite a few “depreciated” warnings in the Yadis code. It would also perhaps be easier for others to use your code if you removed the $_SESSION['loggedin'] parts, as most sites would be using something different.
Hi Again,
I think I was a bit too fast with my previous post. I DID get it working on http://me.yahoo.com, but on http://claimid.com I get an “apache application error”. The same happens on your demo.
no return information?
i need yahoo nickname when login sucecced?
hey the Javascript does not have gmail. can we add it. you script does work fine for gmail.
The JavaScript you’re referring to comes from ID Selector, which can be customized to your liking. But I’m not sure if they have Gmail as an option.
how to resolve this error: Error: Dope OpenID requires the PHP cURL extension.
You can resolve the error by enabling cURL on your Web server.
hi Steve,
i tried your demo link but it’s not showing any information about
Nickname:
Language:
Email
plus i tried it on my localhost but it’s giving me below error
Error: Dope OpenID requires the PHP cURL extension.
i didnt get what it is. could u guide me on this
thanks
vikram
There are a couple possible reasons the user information is not returned: 1) the OpenID provider you’re testing does not give out this information, or 2) the OpenID provider has changed the way it handles user information requests.
Regarding the error message, you can resolve it by enabling cURL on your local Web server.
Hi Steve,
I used two different opemID providers myopenid and yahoo.
now new prob has occur your demo link is giving Error 404 – Not Found
I enabled the cURL on my Web Server after that i again tried it on my local server but it’s still giving me error, see below error
Warning: No HTTP code returned in C:\wamp\www\dope-openid-1.0.1\Services\Yadis\ParanoidHTTPFetcher.php on line 122
Error Code: OPENID_NOSERVERSFOUND
Error Description: Cannot find OpenID Server TAG on Identity page.
do i need to upload this program to any website to get the expected result or i can get the result on my local server too.
please guide me on this
thanks,
vikram
Hey Steve,
we would like to use your class for OpenID integration in our commercial product. Our PHP sources are always ionCube encrypted. Is there also a commercial licence for you library, because I think we may not integrate it because it has been published as GPL instead of LGPL ?
Best regards,
Bjoern
Which license would you prefer?
Thanks for your answer. LGPL or Apache Licence, Yadis is Apache Licence for example.
Hi Steve,
It’s working.
thanks,
vikram
Is there any way to tell the openid provider to only log in? (ie. the user is already registered, but should only log in to my page with his openid)
Looks like I just should leave out the setOptionalInfo() and setRequiredInfo() right?
If you’re only allowing users to log in with OpenID, you are correct. You wouldn’t need the data returned by those methods. But if you are allowing users to also register on your site with OpenID, the data might be useful. Still, I’ve found that attempting to retrieve user data from their OpenID provider is unreliable at best.
If you’ve stored the user’s OpenID and it is associated with a registered account, you can write your code in such a way that receiving a verified user notification from OpenID will trigger your own log in methods. You would need a function that, instead of authenticating with username and password, authenticates with a verified OpenID and retrieves the associated user data. Hope that helps.
Of course, that’s for the initial stuff. Let’s say the user registered and logged in with his openid on my site. And lets say the session lasts “only” for a couple of hours (or the user logs out for some other reasons). The user wants to login somewhen later with his openid (so I have his details and his openid_url).
Is there any shortcut just to log him in with his openid (or as said I then should leave out setRequiredInfo()?
Thanks!
Hi Steve, wanna say BIG THANKS for this script. Unfortunately it doesn’t work with PHP4 out of the box as it written at the top.
Thanks again, script looks promising
Thanks Serge. Sorry about the PHP4 troubles. I may have broken the backwards compatibility at some point.
1.Yahoo:
Your OpenID Identity (https://me.yahoo.com/a/FHxV23I0y5b.d9bU6r5Du61M3ysaDvk-) wasn’t found in our records.
Good news though: We just need your email and a friendly name and you’ll have full access to all the site’s features.
DEBUG: The following information came back from your OpenID provider:
Nickname:
Language:
Email:
2. And where is google on the list?
Solved. But is there anyway to retrieve the yahoo e-mail adress?
According to this post, Yahoo only began supporting Attribute Exchange this past December, which is well after the last code update for Dope OpenID. I haven’t tried it, so Dope OpenID might need some fiddling to get attributes back from Yahoo.
Fixed it. In class.dopeopenid.php edit filterUserInfo() by replacing this line:
if(stristr($key, ‘sreg_’) && array_key_exists($trimmed_key, $this->arr_ax_types)) {
With:
if((stristr($key, ‘sreg_’) || stristr($key, ‘ax_value_’)) && array_key_exists($trimmed_key, $this->arr_ax_types)) {
Thanks – this fix works perfectly for retrieving Yahoo Attribute-Exchange values !
Hi steve,
You have done a great job. Congrats for this. You saved lot of time for developers. I have seen your Dope openid demo (http://stevelove.org/projects/dope-openid/demo/login.php). There i couldn’t find google in the drop downlist. But, you mentioned before, google also working with this. If so, how can i see that in your demo.
Thanking you,
sureace.
Type in http://google.com as your OpenID.
Hi steve,
Thanks for your quick reply. Yes, it works great. Thanks a lot.
Thanking you,
sureace.
Hi steve,
I am starting to integrate it in mysite. If i have found any problems, i will let u know.
Thanking you
sureace
Hi steve,
Is it your library works with wordpress. When i am trying to check at your demo page using my wordpress username, it retuns erros like
Error Code: OPENID_NOSERVERSFOUND
Error Description: Cannot find OpenID Server TAG on Identity page.
Thanking you,
sureace.
Yahoo doesn’t seem to work neither on your demo or when I try it locally. I get to Yahoo’s page that says “You are about to share _info_” but when I am sent back to login.php it doesn’t list any information. Can you confirm this problem?
It’s possible there is a problem. Please read this comment. The source code is on github. You are welcome to work on it. http://github.com/stevelove/Dope-OpenID
Hi Steve, thanks for your works. I try your code in localhost, everything are ok. But I uploaded to our website I couldn’t Sign with yahoo and google but I could sign in with the rest. Can you help me?
Thanks for putting up this code.
I am trying to tackle the integration of an openID consumer for our site and your code should give me a kick start.
Your demo works with my openid provider no problem.
But my demo tells me:
Error Code: OPENID_NOSERVERSFOUND
Error Description: Cannot find OpenID Server TAG on Identity page.
Any idea why this would happen?
I have your demo code installed on a fresh host account with nothing else on it. Thanks for your help!