社交登录重复帐户冲突 [英] social login duplicate accounts conflict

查看:65
本文介绍了社交登录重复帐户冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个新应用,除了常规的电子邮件/密码注册外,还需要进行多次社交注册,但是有一种特殊情况可能会导致数据完整性问题...

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 ...

示例:

  1. 用户注册了facebook,但未返回任何电子邮件.
  2. 我在数据库中创建一个用户,该用户的电子邮件和密码设置为null,并创建一个包含其ID,令牌和提供商名称的社交资料条目.
  3. 然后用户下次使用电子邮件和密码注册,因此我在users表中为他创建了一条新记录.

现在他为同一个人有2个条目.

And now he has 2 entries for the same person.

该如何处理?

推荐答案

电子邮件是此处唯一可识别用户的方法,因此,解决此问题的最简单方法是强制用户提供其电子邮件(如果未提供)在Facebook的回应中返回. 您可以轻松地执行此检查,并相应地将用户重定向到另一个视图/页面"以输入他的电子邮件,甚至可以要求用户添加一些其他可选字段.希望这会有所帮助

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

这篇关于社交登录重复帐户冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆