chok / sfMelodyPlugin

Allow to communicate with many services(google, yahoo...) throw OAuth
MIT License
45 stars 21 forks source link

Google Authentication #2

Open ribeiropaulor opened 14 years ago

ribeiropaulor commented 14 years ago

Hello,

I'm trying to use the plugin to give the users of my site the possibility to login with their gmail account. I've succeed to register the application and the site can log the user in. However, each time the user comes back, a new user is created.

How can I associate the same returning user with his account? How can I get his e-mail and save to sfGuardUser?

Could you please make an example available?

PS: I've read the introduction available at OpenID site. I'm familiar with those concepts now.

Regards, Paulo

ribeiropaulor commented 14 years ago

Hi,

I think I was wrong. Reading your code again I assume that the plugin is just for using OAuth API's. In order to login we have to implements OpenID+OAuth. Is that right? From what I've observed, sfMelodyPlugin does not implement the latter.

Regards, Paulo

chok commented 14 years ago

Hi,

You're right the plugin don't implements OpenId+Oauth, just OAuth. It's my personnal opinion but I think OpenId is note very necessary.

Because with openid you have to take the id of the user with OAuth nothing is required you just ask authorization data.

For me OpenId is just a way to have the basics information which could be retrieve by OAuth and I make the choice to don't make the implementation of that.

In fact, sfMelody allow to manage users but in a bad way at the moment. And not for google because the method getIdentifier() of sfGoogleMelody isn't implemented yet.

You can implemented it to retrieve some informations to create the user. B

I have definitely need to work on that to make easier connection and creation of account.

If you can't waiting just implements getIdentifier() to create an user with the username you want.

Thanks for your feedbacks, Don't hesitate if needed,

Maxime

gimler commented 14 years ago

i have the same problem and i work on it at the moment to fix this.

plan: with this scope https://www.googleapis.com/auth/userinfo#email you can get the email address from the user and then use retrieveByUsernameOrEmailAddress to get the user from the database. for facebook you can get it via scope email.

ribeiropaulor commented 14 years ago

Hi Maxime,

You're right. OpenID is not necessary. However don't you think if you need only signing in capabilities, OpenID is way faster than OAuth? I mean, couldn't the library evolve to support both approaches?

I seems interesting having both implementation working together.

Anyway, you've done a great job!

Regards, Paulo

chok commented 14 years ago

Hi,

For the problem authentification, You can check the new user creation system. I love it :)

If you have some recommendations to improve it don't hesitate.

@ribeiropaulor You're right too. OAuth has a problem because it's its primary aim after all. Its problem is you have to request a token you already have in your database because OAuth is not thinked to do that and I think this plugins need have both implementation.

So why not in a next version :)

fain182 commented 13 years ago

there are some news about it? I would create the user with google, but I'm not so confident with this code to "just implements getIdentifier() to create an user with the username you want.".. There is someone that already implemented it?

(this plugin anyway it's great.. thank you!)

fain182 commented 13 years ago

I noticed that users are created without problem, and only once for account. The only problem is that google ask me for authorization everytime instead of log me in, what should I change for solving these? I can do it without recurring to OpenID?

mayeco commented 13 years ago

@ribeiropaulor you can use this https://github.com/mayeco/sfOpenIdOAuth is a sandbox app for using openid+oauth with sfMelodyPlugin and sfPHPOpenIdPlugin, let me know if works for you.

ribeiropaulor commented 12 years ago

Nice! I'll give it a try as soon as I have time. Thanks!