Can any of you point me in the right direction of the best practices to use the information obtained from facebook for a forum like application.
So, in the application, the user has the ability to use the facebook login option (also twitter/google options are available).
So, to post a forum like entry, the entry needs to be associated with a user.
What is the best way in achieving this? Using the facebook name/surname + email to create a user on my backend server?
Any advise would be appreciated please.
Yes, what you said is correct. You can query profile information from the authentication provider.
I would look at picking up the most common attributes to maintain data consistency across service providers(Facebook, Google, Twitter etc) i.e. email, firstname, last name.
Create a user in your DB against the email address and authentication provider. The data sample would look like below:
userid email authprovider
------ ----- ------------
0001 me@gmail.com Google
0002 you@gmail.com Facebook
0003 some@gmail.com Twitter
userid ForumEntryId
------ ------------
0001 0001
0001 0002
Every time the user logs in using any of the authentication providers, you could update the profile information like FirstName, LastName.
One thing I would like to see someone implement it is that:
When a user does a login with Facebook and next time around they come in a say login with twitter; if the email matches and the provider does not match the site typically says that 'The email is already in use' or something similar. It would help if the site says 'You logged in with Facebook last time, please use the same account.' or handle it even more gracefully. :)