ASP.NET Identity 2.0 simplifies task of social authentication in an ASP.NET MVC App at the great extent. There are lot to learn about ASP.NET Identity 2.0 and in further posts I will cover that. However In mean time if you are curious you can find the resources for ASP.NET Identity 2.0 here

To start with I created an ASP.NET MVC Application in Visual Studio 2013 y choosing MVC project template as follows:


Great, once the project is created next you need to configure Twitter for the application. To start with navigate to and select Create New App as shown below:


To create the Twitter application fill the form as follows. Off course you should provide Name, Description and Website information as of your application. Callback URL filed is worth discussing here, for development environment use instead of localhost as the server for Callback URL. For any other server give fully qualified server name. To create the new Twitter application form can be filled as follows:


That’s it. Now click on API Keys and copy the API Key and API Secret, you will need them in the application.


At the last step you need to open the project and browse to the App_Start folder. In this folder you will find a file Startup.Auth.cs. Open this file and uncomment the code app.UseTwitterAuthentication. You should also provide the consumerKey and consumerSecret key from Twitter here. (we created these keys in previous steps)



This is it Press F5 to run the application. And click on Login, you should see the Twitter option in Use another Service to log in.


Click on the Twitter option and you will be asked to authorize the app.


Once authorization is done, you can register with the Twitter username.


Now you are logged in to the application using Twitter account. So as you see ASP.NET Identity 2.0 makes it super easy to work with social authentication in the ASP.NET MVC or the ASP.NET application.

In further posts, I will share more on ASP.NET Identity 2.0 learning. Happy Coding.


2 thoughts on “Walkthrough: Login with Twitter Account in ASP.NET MVC 5 APP using ASP.NET Identity 2.0

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s