I'm working on a new social networking site and I want to give users a way to:
1) Automatically scan my site for people they already know (email/linkedin/facebook/etc)
2) Provide users with the option of inviting their friends to join the site
It seems like many of these tools have their own api, but in most cases it doesn't look like I would be able to get a unique id (the email, basically). Are there other tools out there I could/shoul开发者_如何学God look at?
I implemented this on one of my sites. When users register for an account, I require an email address. I give them an option to find their email accounts (gmail, hotmail, aol, and yahoo all have oauth services you can use to get contacts). I also give them the option for LinkedIn, Facebook, and Twitter. This doesn't work as well as those 3 social networks won't disclose email addresses (and rightfully so). So each user that authenticates, I log their id from that service. Then I get the id's of their friends, and see if any of those friends have associated their account with my site. The key for this to work is to encourage your users to associate those accounts.
As for Facebook, unfortunately this is not possible using email since users may choose not to share their real email with you.
One way, for Facebook, is to store the Facebook user id (you should be doing this anyway) and retrieve the newly registered user friends' ids and check if any of these ids present in your DB.
精彩评论