处理存在的用户,但尝试通过Facebook OAuth / etc登录 [英] Handling users that exist, but try to login through Facebook OAuth / etc

查看:102
本文介绍了处理存在的用户,但尝试通过Facebook OAuth / etc登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的网站上有一套体面的现有用户,通过他们的电子邮件地址作为用户名登录。

I've got a decent set of existing users on my website who login via their emailaddress as their username.

我正在设置Facebook OAuth机制,以允许新用户更方便地注册,但是当用户已经在我们的系统上注册了一个电子邮件地址,现在尝试通过Facebook登录时,我不知道如何处理这种情况。

I'm setting up Facebook OAuth mechanism to allow new users to sign up more conveniently, but I'm not sure how to handle the scenario when a user who already has an email address registered with our system and now tries to login via Facebook.


  1. 我应该认为他是同一个用户吗?

  2. 我应该像新用户一样对待他吗?

由于我没有验证他们的电子邮件地址(当他们直接登录到我的系统)时,情况更复杂,所以我不能假定他们是同一个用户。

The situation is more complicated by the fact that I dont validate their email addresses (when they login directly into my system), so i cant assume they are the same user.

其他人如何解决这个冲突,还是别的人只是把这个用户通过FB连接起来作为一个新的实体?

How do others resolve this conflict, or do other folks simply treat this user connecting via FB as a new entity?

推荐答案

在您的登录屏幕上,用户可以选择:您可以将

On your login screen, users can have a choice: you may put


  • 新用户:使用Facebook注册

由于这是一个全新的用户帐户,那么您只需要

since this is a totally new user account, then you just need to do your facebook connect + request for email permission, etc.


  • 现有用户:通过电子邮件登录

一旦他们这样做,让他们使用老式的方式登录。然后登录后,提示他们将此电子邮件地址连接到他们的Facebook帐户。所以流程是通过电子邮件登录,然后可选的Facebook连接。

Once they do this, let them login using the old-fashioned way. Then once signed in, prompt them to connect this email address to their facebook account. So the flow is login via email then optional facebook connect.

为此,我假设您已经在user_accounts的数据库表中添加了一个字段,即 facebook_user_id fb_id user_id 等。然后在Facebook连接上,获取登录电子邮件, UPDATE表SET fb_id = xxx WHERE email = xx

To do this, I assume you've added a field on your database table for user_accounts, that is facebook_user_id or fb_id or user_id, etc. Then on facebook connect, get the logged-in-email, UPDATE table SET fb_id = xxx WHERE email = xx

这篇关于处理存在的用户,但尝试通过Facebook OAuth / etc登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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