在 Meteor 用户文档中合并 Twitter 和 Facebook 帐户 [英] Merge Twitter and Facebook accounts in Meteor user doc

查看:45
本文介绍了在 Meteor 用户文档中合并 Twitter 和 Facebook 帐户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我正在使用 Meteor 构建一个应用程序,并注意到当我使用 Twitter 和 Facebook 登录时,我创建了两个单独的用户帐户.是否有任何内置方法来确保这些合并?我在基于 twitter 的用户帐户中没有看到任何电子邮件地址,因此我可以看出可能很难确定要链接哪些帐户.

So I'm building out an app with Meteor and noticed when I log in with Twitter and then Facebook, I create two separate user accounts. Is there any built in way to make sure these are merged? I'm not seeing any email address in the twitter based user account, so I can see it might be difficult to figure out which accounts to link.

建议?谢谢!

推荐答案

我也遇到过类似的情况,所以这里有一个很好的起点:

I've been in a similar situation so here's a good starting point for you:

您可能希望在 Accounts.onCreateUser 事件中进行合并.基本上,此时您要做的是:

You might want to do the merge at the Accounts.onCreateUser event. Basically, what you would do at this time is to:

  • 执行强制性协议/例程,尽可能以任何身份验证方法将电子邮件保存在某个配置文件字段中,以便您能够执行下一步,即..

  • Do a mandatory protocol / routine to save the email in some profile field in any authentication method as much as possible, so that you are able to do the next step, which is..

每当使用其他身份验证方法(创建用户)时,您都可以比较现有的用户数据库(现在确信电子邮件字段将始终存在以进行检查),并在任何时候进行合并发生精确的电子邮件匹配.

Whenever another authentication method is used (to create the user), you can compare the existing database of users (now confident that an email field would be present at all times to check against), and do the merge whenever an exact email match happens.

很遗憾我现在没有代码,因为我尝试过一次该协议,但我很快决定出于某种原因只使用一种身份验证方法.也许我会在我有时间尝试再次编码时更新这个答案......或者可能不会.

It's a shame I do not have the code now because I tried this protocol once, but I quickly decided that I'll just stick with one authentication method for some reason. Maybe I'll update this answer when I can get around to try and code that again.. or maybe not.

这篇关于在 Meteor 用户文档中合并 Twitter 和 Facebook 帐户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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