用户详细信息保存在名为 user 的数据库表中,其中有用户名和密码等字段。现在,我需要为用户提供使用 Facebook 和 Twitter 登录的附加选项。 我知道如何处理这些身份验证,但我想不到的是 -
如何识别哪个FB用户帐户与哪个本地用户帐户相关?我该怎么做?
我不是在寻找代码,而是在寻找过程。我脑海中的过程大致如下 - 用户使用我的网站的用户名和密码登录。然后他们可以添加 FB 或 Twitter 作为外部身份验证,当他们这样做时,我要求他们登录 FB。成功登录 FB 后,我会在用户表中保存一些唯一的 fb id(我不知道哪个,因为尚未检查)。下次他们可以使用 FB 登录,因为我能够识别他们属于哪个本地记录。您会这样做吗?
你有什么建议?感谢您提前提供意见。
PS - 我将添加多个网络(例如 linkedin 等),但目前仅添加 Facebook 和 Twitter。
最佳答案
实现此目的的一种方法是: @注册
1. Allow the user to register with Facebook, Twitter
2. Once the process has completed, redirect the user to create a username on your site
3. Using the email obtained from Facebook, Twitter, and username from local form, insert all this information into a db table.
4. This will allow referencing between FB, TW, and local usernames
关于php - 为网站用户添加 facebook/twitter 登录选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11648961/