将通过 Facebook 连接登录的新用户链接到现有帐户

发布于 2024-08-23 07:07:32 字数 168 浏览 4 评论 0原文

我最近通过 facebook connect 实现了登录。所以现在用户有两种方式登录该网站。注册帐户的旧方式和新方式(facebook connect)。

我想做的一件事是将新的 facebook connect 用户帐户链接到现有帐户(如果他们以旧方式登录)。

有人在这方面取得过成功吗?

I have recently implemented login to my via facebook connect. So now users have 2 ways of logging in to the site. The old way of registering an account and the new way (facebook connect).

One thing I would like to do is link a new facebook connect user account to existing accounts if they logged in the old way.

Has anyone had any success doing this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

高跟鞋的旋律 2024-08-30 07:07:32

我认为这是一个很好的问题,很多人都会从答案中受益。

您需要记住的是,只有经过 Facebook 授权才能链接的帐户才会被链接。您应该做的是在数据库中维护第二个关联帐户表,以便您知道谁是谁以及他们是否与 Facebook 关联。

您应该阅读此集成评论,它提供了很多有用的信息。

http://crazyviraj.blogspot.com/ 2010/01/test-cases-for-basic-facebook-connect.html

它并没有真正说明如何做事,但它确保您勾选了您应该做的所有方框。

IE:

如果用户拒绝,注册将会失败
应用程序的权限(类别:标志
上)

因为我们需要访问电子邮件
地址,如果
用户提供了发布权限,但是
拒绝电子邮件权限(类别:
注册)

如果用户提供电子邮件地址
您的系统中已经存在,
注册失败。确保没有 YouFace
修改后端表(类别:
注册,1:1映射)PS - 当这个
发生了,我没有找到适合你的方法
取消对 YouFace 的授权
Facebook 用户的代表。用户必须
如果他们希望您使用,请手动执行此操作
相同的帐户,但提供
不同的电子邮件地址。

使用 Facebook 创建的帐户
连接应该无法登录
使用 YouFace 的默认电子邮件/密码
登录系统(类别:登录,
帐户安全)。 PS:自从YouFace
帐户需要密码,并且这些
使用 Facebook Connect 创建的不,
确保插入随机密码
散列到你的表中以避免愚蠢
错误

使用 YouFace 创建的帐户应该
无需任何要求即可登录
登录 Facebook,即使
当链接到 Facebook 帐户时
存在(类别:登录)

还有更多

Very good question I think and lots of people will benefit from an answer.

What you need to remember is that accounts are only linked so long as they are authorised to be linked through Facebook. What you should do is maintain a second table of linked accounts in your database so that you know who is who and if they are linked with Facebook.

You should read this integration comment, it provides a lot of useful information.

http://crazyviraj.blogspot.com/2010/01/test-cases-for-basic-facebook-connect.html

It doesn't really say how to do things, but it makes sure you tick all the boxes of what you should be doing.

ie:

Sign Up should fail if the user denies
permission to the app (category: sign
up)

Since we need access to an email
address, Sign Up should fail if the
user provides publish permission but
denies email permission (category:
sign up)

If the user provides an email address
that already exists in your system,
fail Sign Up. Make sure no YouFace
backend tables are modified (category:
sign up, 1:1 mapping) PS - when this
happens, I didn't find a way for you
to de-authorize YouFace on the
Facebook user's behalf. The user must
manually do this if they wish you use
the same account but provide a
different email address.

Accounts created using Facebook
Connect should not be able to login
using YouFace's default email/password
login system (category: sign in,
account security). PS: Since YouFace
accounts require a password and those
created using Facebook Connect don't,
make sure to insert a random password
hash into your table to avoid silly
errors

Accounts created using YouFace should
be able to sign in without requiring
to be signed into Facebook, even if
when a link to a Facebook accounts
exists (category: sign in)

Any many more

且行且努力 2024-08-30 07:07:32

您应该通过 fb connect 身份验证请求永久访问。完成此操作后,您将获得一个令牌,该令牌允许您访问某人的 Facebook 信息,并且该令牌不会过期,除非用户明确将您从权限列表中删除或更改他/她的密码。

获得令牌后,将该令牌与用户关联/在用户表中创建一个新字段来存储它。

要在用户未登录的情况下将用户与 Facebook 帐户关联,您可以尝试通过电子邮件进行匹配。它不是 100% 准确,但相当不错。 Facebook 不会以文本形式向您提供电子邮件地址,但您可以从 FQL 获取电子邮件哈希值。由于您已经知道用户电子邮件地址,因此您可以计算所有用户电子邮件的哈希值,并在每次新 Facebook Connect 用户注册时在您的用户群中搜索匹配项。

You should be asking for permanent access through fb connect authentication. Once you've done that, you'll get a token which gives your permission to access someone's Facebook information, and that token will not expire unless the user explicitly removes you from the permission list or changes his/her password.

Once you have the token, associate that token with the user / create a new field in your user table to store it.

To associate the user with a Facebook account without the user logging in, you can try to match by email. It's not 100% accurate but it's pretty good. Facebook doesn't give you email addresses in text form but you can get email hashes from FQL. Since you already know user email addresses, you can calculate the hash for all of your user emails and search through your user base for matches every time a new Facebook Connect user signs up.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文