多种身份验证的数据库架构,Facebook Connect,Twitter,OpenID等 [英] Database Schema for multiple authentications, Facebook Connect, Twitter, OpenID, etc
问题描述
有人可以给我指导我的数据库模式应该如何在同一时间从各种社交网络中捕获用户信息?我有一个想法(根据我在线阅读)是这样的:
用户{userid,...}
用户Facebook {fbid,userid ,...}
UserTwitter(twid,userid,...}
等等。
然后要获得一个用户的完整图片,我将加入所有的用户表。这是其他网站做的还是更聪明/更好的方式?
我建议您将用户模式分为两个表:用户和身份
身份应具有:Id,用户ID,适配器,哈希。
对于用户名/密码认证适配器,哈希将是散列(例如MD5 / SHA1)密码,而其他适配器(Facebook,Twitter等)将是Auth Provider提供的令牌。
祝你好运。
I am building an application that I want to interface with Facebook Connect, Twitter, OpenID, and potentially other social networks. Users will be able to login using any number of these methods at the same time. My application uses MySQL as a backend database.
Can someone give me guidance on what my db schema should look like for capturing user info from various social networks at the same time? One idea I have (based on my reading online) is something like:
User {userid, ...}
UserFacebook {fbid, userid, ...}
UserTwitter (twid, userid, ...}
etc., etc.
Then to get a complete picture of a user I would join across all the user tables. Is that how other sites do it or is there a smarter/better way?
I suggest you have your User schema in two tables: Users and Identities. Identities should have: Id, User Id, Adapter, Hash.
For username/password authentication adapter, the Hash will be a hashed (MD5/SHA1 for example) password, while other adapters (Facebook, Twitter, etc) will be the token provided by Auth Provider.
Good luck.
这篇关于多种身份验证的数据库架构,Facebook Connect,Twitter,OpenID等的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!