简体   繁体   中英

User registration after facebook / openid login

I have a website where users can publish an add after they are logged in. I want to implement OpenId and Facebook Login and I was thinking to do it like this : - once a user is authenticated i will automatically create an account on my site using their name and email ( the ones i got from facebook/openid response).I think this is mandatory since I need an user_id in order to save their add into database. - next time they login i check if they have already a generated account and logged them in if is the case.

The above logic worked for OpenId(Google and Yahoo) since they return a openid_identity which seems unique for each user and can be used as password. But i don't have such data on Facebook $facebook->api('/me','GET'); . This may me think i'm not doing thing in the right way.

So, What is the best solution for adding OpenId and Facebook in this case ? If this is a correct way what can i use as password for Facebook generate accounts ?

Thanks

I suppose you use Oauth2, since there is no OpenID provider at facebook. You may use user id provided by $facebook->api('/me','GET'); which is always linked to particular user. And later you re-ask it at each fb login to compare with stored data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM