social login duplicate accounts conflict

北战南征 提交于 2019-12-25 09:09:02

问题


I'm making a new app the would need multiple social registration beside the regular email/password signup, however there is a particular case that might cause problems with data integrity ...


Example:

  1. A user signs up with facebook but no email was returned.
  2. I create in the db a user with email and password set to null, and a social profile entry with his id, token and provider name.
  3. then the user next time signs up with email and password, so i create a new record in users table for him.

And now he has 2 entries for the same person.

how should I deal with this case?


回答1:


Email is the only way here to identify the user, So the easiest way to deal with this would be to force the user to provide his Email if it was not returned in the response from Facebook. You can easily do this check and redirect the user accordingly(to a different View/page) to enter his email, or even ask the user to add some additional optional fields. Hope this helps




回答2:


normaly if email is null that because the user use something else for is facebook login (like phone number)

If the property email is null you can fallback to an error message, or set a FacebookId with the public_profile id and ask the user to put an email adresse into your app.

Dont use email as primary key ;) and dont forget, have an internal login/password for all user. Facebook Twitter is just an other way to login but not the main mechanism.



来源:https://stackoverflow.com/questions/39295204/social-login-duplicate-accounts-conflict

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!