Dealing with Social Logins

First of all am not sure this is the right place. if not Mods please move it to the right subforum

I am asking not how to do social login code but how it is done. I can for example collect user details from Facebook. Thats easy.

What am asking is what do I do with them in scenario where my user table have COMPULSORY field like say birthday and many Networks don’t provide that. Should I make new Table for holding those users with social networks? But then how about user that have multiple accounts using same Email (g+, FB et al)? Should a table have surrogate PK so that that issue is gone?

Am confused with these kind of logins but I want them integrated in my systems!


You could create two-step registration - after login from service you could display form with required fields.

Sounds great Idea.

Do you have Idea on how to tackle the other problem namely having multiple social profiles using same email?

Each service should provide unique id, you could just create special field for each of them, eg facebook_id, google_id etc. Then you could aggregate many services in one account, and also easy find user with specified id of service. Additional info from service you could store in similar way as serialized arrays - then you can’t search by them, by you probably don’t need that.

Great. Now I think it’ll be better to make new table let say called social_profiles with columns

social_id | email |reg_time

whereby the first two forms composite PK

So in login I will follow these stages

[list=1][]Check if Email have that specific social_id[]if yes login user[]if No check if user have any details in user table[]If yes just add that social ID and log him in[]if No user have no details at all in any table, present him with the missing details[]Save profile in social_profiles[*]Log him in[/list]

1 Like