With the release of Visual Studio 2012 this evening, the ASP.NET team over at Microsoft has made it so easy to provide Open Auth login to your sites. How easy you might ask? Let’s take a look shall we?
Picking the right template to start out with gets you half the way there. The “ASP.NET Web Forms Application” and the “Internet Application” from the mini ASP.NET MVC 4 template menu will provide a section of commented code in a file called AuthConfig inside of the App_Start folder.
The second half of the magic happens by uncommenting the code in the AuthConfig. You will however have to provide some details for the provider that you want your users to login with such as signing up as a developer on twitter.
public static class AuthConfig
{
public static void RegisterAuth()
{
OAuthWebSecurity.RegisterMicrosoftClient(
clientId: "",
clientSecret: "");
OAuthWebSecurity.RegisterTwitterClient(
consumerKey: "",
consumerSecret: "");
OAuthWebSecurity.RegisterFacebookClient(
appId: "",
appSecret: "");
OAuthWebSecurity.RegisterGoogleClient();
}
}
After not even breaking a sweat, you should be able to login with your chosen provider
There is more! Once you have authenticated with your external provider, you have the ability to associate more external provider accounts.
Well done to the ASP.NET Team. I am sure this is probably going to be one of the most loved features!
Read More

