0
votes

I am creating a user registration page little bit similar like stackoverflow. For that i must give an opportunity to the user if he has any account already exist on 3rd party networks like facebook , twitter , google or linkedin then instead of custom registration.

i need to save their 3rd party network Ids,emails , name in my database in user table. So that if that particular user come and provide similar user name and his authentication become successful then i can give him access to use the user pages on my site. ( I am not interested in saving password for 3rd party networks social network)

I am bit confuse how can i build such kind of system , some one told me openid and openauth but i am not sure which one can give me correct result?

1

1 Answers

1
votes

For this question it isn't important whether you choose to use openid or openauth both will provide you with an identity for the user. The way I tend to do it is like so:

table users_openids(identity, user_id, created, last_used, ...)

then it allows your users to attach multiple identities for in the event you want to import data from many of them.

For logging in via an identity you simply need to lookup the user_id in your main table.

So, for existing users simply add a row for them, for new users insert a new user at the same time with a NULL password and be sure to handle it correctly in your application logic. As you should be using hashes then you will never hit a match if someone entered NULL anyway.