Search code examples
asp.netasp.net-mvcasp.net-mvc-4membership-provider

Custom Membership provider with oAuth


It's my first contact with MVC so please be understanding for me. First of all:

1) If I will implement custom Membership provider with sql database, with my methods to activate user via e-mail, putting user into database etc. (and just one table - tableUsers), this solution about oAuth and Facebook login will works properly?
Honestly, it's not clear for me at all.

2) What solution is better. My custom membership provider, or using default?
I want to sending my custom activation e-mail, then activate account. Later, I want to add new columns into userProfile table - "ID type" and "isActivated".
I will storage additional info about user in separate table (telephone, webiste, about me, hobby etc) - I will get this data by IDuser from userProfile.
What is more, I want to use loggin method via Facebook or Twitter. I found solution on asp.net website, how to do it with Oauth.



What solution I have to choose?
Regards


Solution

  • What solution is better. My custom membership provider, or using default?

    As you want to store extra user information in the database, you will need to create your own custom Membership Provider as the default one lacks this flexibility. Also with the default membership Provider , you will not be able to verify your user with an activation email. You will have to customize it.

    How to do it with Oauth.?

    The default Membership Provider provided with MVC4 in VS 2012 has the ability to do login using Facebook and Twitter and you can add even more like LinkedIn. But, as you will need to create Custom Membership provider for storing additional information, you can use DotNetOpenAuth library for this. It is the same used by the default Membership Provider. You can add it through Nuget.