开发者

what is the best database design to connect and use social networks for the users?

In my current application, I'd like to offer the possibilities for the users to connect them trough a password or any social network or open id platforms.

I'd also will post message on their wall (facebook, twitter, buzz mostly) if they link their accounts to my app.

The problem I face is how I can organize my tables in the database.

Here's how I would do, but without any convictions :

User(first_name, last_name, email)
LocalUser(password, user_id)
FacebookUser(token, user_id)
GoogleUser(token, user_id)
EtcUser(...)

If the user connect through Facebook, I will fill all the data in the User table I can, and then he will have the possibility to connect my app to other networks (like Google and Twitter).

But the problem of this implementation is if the user connect through Face开发者_如何学Gobook one time, use the app without connecting to others social layers, and later, connect himself via Google, the app won't recognize it's the same person and will create a new account, from scratch.

Also, It's possible that the tables for the session (FacebookUser, GoogleUser, etc) and the tables for the linked accounts would be different (maybe the token to access the social network and the key to use the app is different ?)

I already have a session table like this one :

// Maybe I should add a new column for identifying from which type come the token (Local, Facebook, Google, etc)
Session(date, ip, token, user_id)

Do you think this method is good ? do you have a better one ?

Thank you ! very much !

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜