Yahoo, MyOpenId, AOL, OpenId) as well as Facebook Connect and Twitter Oauth for
authentication of users.
During authentication, information about a user (e.g. an email or a country) is fetched from the authentication provider.
Zend Framework 1.11 does not have a very good support for OpenID, not mentioning Facebook Connect and Twitter Oauth. Thus, to make it all work the following elements were used:
- openid-selector
- My_Auth_Adapter_Facebook by Michael Krotscheck
- My_Auth_Adapter_Oauth and My_Auth_Adapter_Oauth_Twitter by Jason Austin
- My_OpenId_Extension_AttributeExchange by Chris Bisnett
- Patched Zend_OpenId_Custumer
The demo of this application is here , while the source code is at GitHub. The user authentication is performed in a loginAction in UserController.php.
Hopefully, this example application will be useful to others as it was for me.
Great post! I made something similar myself, maybe we can join forces to create a proposal and add this things to zend framework, what you think?
ReplyDelete@nebiros
ReplyDeleteI'm glad you like it. You can use the example for making the proposal. However, won't ZF 2 support these authentication providers? I know that with ZF 1.11 is a problem.
Iam using ZF 1.11. Below is demo url:
ReplyDeletehttp://articlecon.com/phpdemo/tf
When I type twitter.com, facebook.com, it always gets back to site page, with amessage "Authentication Failed. You are not logged in". I have checked, time and again, keys and secrets of both Facebook and Twitetr, both are correct.
Can you guide me, what and where Iam doing wrong.
Thanks in advance
@Anonymous.
ReplyDeleteI see you modified the login page. Without seeing the modified source code I cannot tell you what's happening.
can you please provide the one URL which is working at your site.
ReplyDelete@Anonymous. Thanks for the suggestion. I'll try to create some dummy accounts that can be used to test the app.
ReplyDeleteHi,
ReplyDeleteThanks for this post, it is really a great help as I am working on a project implementing this. I however have a problem. While Facebook and Twitter are working normally, I am encountering redirect loop with Gmail and Yahoo after the user supplies their login details at the providers site. I have gone through the code many times and I can't seem to understand where the problem is...
This comment has been removed by the author.
ReplyDelete@Steve Popoola
ReplyDeleteI seet at http://www.stevepop.com/ that you modified the code of the example. Without more details its difficult to say what is the cause of your problem.
Hey man.. im having problems with google profile !!
ReplyDeleteIn your demo, logins fails too!
At my site in debug mode i have problems to save an discovery file on tmp folder!
U have this problem too ?
@pSy vito
ReplyDeleteHi. Could you provide more details what's happening. Are you getting any exceptions, error messages etc.
Thank you for this post.
ReplyDeleteWhile Facebook works normally, I have some trouble with Twitter.
When the session expires or the user signs out application, does the app have to take the user through the whole OAuth process from the beginning next time they want to sign in?
@Oleg.
ReplyDeleteMy demo is just a basic example. Of course, you could avoid taking the user through the whole OAuth process next time by setting e.g. a cookie.
Hello,
ReplyDeleteI'm trying to implement their adapter, google and yahoo,
but am having no success, it returns me
only the message "Redirection faild, "would have forgotten something,
just put the controller if the js, imgs,. ini, the adapter configured openid bootstrap, since I do not know what to do, help me?
For google and yahoo you need to patch Zend_OpenId_Consumer. Have a look at source code. it is at github.
ReplyDeleteHi, the twitter and google work great but I think the facebook is now broken since they switched authentication - can't login via fbook in the demo. Awesome source but thought I'd give you a heads up.
ReplyDelete@Anonymous
ReplyDeleteThanks for the info about changes in facebook authentication. I fixed this problem. I only needed to update zfopenid details in my facebook developer website.
Thanks, nice post
ReplyDeleteAm trying to login with facebook.com, twitter.com on the demo and none of them seems to be working. Please help me out with a lead.
ReplyDelete@Anonymous
ReplyDeleteDo you get any error messages? I cannot replicate the problem. I would help me a lot if you could provide some more info.
For Google OpenID:
ReplyDeleteFirst, in the _discovery method add the following on the series of preg_match checks that starts at around line 740.
} else if (preg_match('/([^<]+)<\/URI>/i', $response, $r)) {
$version = 2.0;
$server = $r[1];
For me, that's all. But, if for you doesn't work, i'm show all information page:
http://stackoverflow.com/questions/741345/how-do-i-implement-direct-identity-based-openid-authentication-with-zend-openid/844350#844350
This is a ZF Issue:
http://framework.zend.com/issues/browse/ZF-6905
hi,
ReplyDeletei have problem with facebook login, i created a facebook application and given the appcode and key , its going to fb url and returning only access token. what i have to do???
plz help....
Excellent resource. thanks you very much.
ReplyDeleteHello,
ReplyDeleteHow can I retrieve information from the user when the login and authorization is performed?
Thanks.
I'm trying to run the example code exactly the way it comes out of github. I'm getting this error:
ReplyDelete"Fatal error: Cannot use object of type stdClass as array in /application/controllers/IndexController.php on line 22"
Anyone know how to fix this error?
Thanks so much for this post, I did exactly what you did and it works great I wish you'd add the verification part as well sometime
ReplyDeleteThanks for the great exmaple.
ReplyDeleteIt really helped me al lot!
But is there any possibility to use a popup for authentification?
Hi.
ReplyDeleteI am getting this error.
Catchable fatal error: Object of class stdClass could not be converted to string in application\views\scripts\_partial\properties.phtml on line 3
hi
ReplyDeletewelcome
ReplyDeletenice
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteI am trying to login with facebook, but after I log in, it responses "This webpage is not available". I found problem in UserController "$result = $auth->authenticate($adapter);"
ReplyDeleteCan you help me?