Integrating Facebook Authentication with existing ASP.NET Membership

naveen picture naveen · Mar 1, 2011 · Viewed 15.5k times · Source

Coding Platform: ASP.NET 4.0 WebForms with C#

We have a website with the existing login details managed by ASP.NET Membership Provider.
Now client wants to add Facebook Connect to it.

So on registration I am giving a Register using Facebook Button.
How shall I proceed with integrating a successful authentication from facebook to my membership provider?

What I am planning is to create a username with unique identifier as a new user in ASP.NET Membership and link that to another table that contains other open-id users(cos in future we plan to extend to Google, Twitter, Live and all). Is that the best method?

Answer

Manuel Pedrera picture Manuel Pedrera · Mar 5, 2011

Well, I think that you have two options here.

Option A: Use the Facebook Registration Plugin and then get the user registered as a regular user i.e. no FB user id is stored into the db, you only have one type of user.

Option B: Ask for email permission within your FB connect and get the user email in order to compare against your user table and make a match (your user table id with FB uid) in case it's found into your DB.

HTH!