Congratulations! You're almost on the right track. Let your situation be here.
Perfect situation
1. Registered on your site 2. Log in with Google 3. Log in with Facebook
Now, take the common denominator here, I mean the primary key. I assume that in your case it should be an email address.
Actual process flow
1. User registers. You save the email address
Or
2. User registers with Google/Facebook and you save the email address.
Login Procedure
1. You receive the email address either from direct login/facebook/google. 2. You match it against your table 3. On positive match, you link this social login to an existing account
If
4. It is not a positive match then you accept whatever data you receive and then forward and then pass on to the registration page.
Hope this helps! Let me know if you want to know anything else.
Hooray!
source share