Twitter Authentication in MVC5

Rama Sagar
Posted by in ASP.NET MVC category on for Beginner level | Points: 250 | Views : 6424 red flag

There are Various Types of Authentication which we can use to login in our Applications...This Article Provides a brief Explanation on Twitter Authentication in MVC5 Application


In this Article we will learn how to Authenticate  MVC Application with Twitter can check my Previous article on Facebook Authentication here...

Let's start to authenticate the MVC Application with Twitter :

  • Step 1  Register yourself as a App Developer in Twitter by opening from your Browser and sign in with your Credentials...
        Note:- Your Email must be confirmed with twitter before you sign in 
  • Step 2  Now Click on Create a new Application as shown Below...

  •  Step 3  Enter all the Necessary Details you can provide a call back URl as and click on Create your Twitter Application
  • Step 4 Copy the consumer key and consumer Secret Values as shown below

Now lets Create a MVC Application 

  • Step 1 Create an  MVC Application 
  • Step 2 After Creation you will find Startup.Auth.cs class file in App_Start Folder 

Using the code

  • Step 3 Open Startup.Auth class file Here you can watch  UseTwitterAuthentication code is Commented..
  • Step 4 uncomment the Code and Provide the Consumer key and consumer Secret key which we had copied Earlier
using Owin;

namespace MVCStudents
    public partial class Startup
        // For more information on configuring authentication, please visit
        public void ConfigureAuth(IAppBuilder app)
            // Enable the application to use a cookie to store information for the signed in user
            // and to use a cookie to temporarily store information about a user logging in with a third party login provider

            // Uncomment the following lines to enable logging in with third party login providers
            //    clientId: "",
            //    clientSecret: "");

               consumerKey: "",
               consumerSecret: "");

            //   appId: "",
            //   appSecret: "");


  • Step 5 Debug the Application and click on Login we will find the Twitter Button as shown below

  •  Step 6 Click on the Twitter Button and you will be ask to Authorize app ..Click on Authorize app



  •  Step 7 it will Redirect to our Application  as shown 

  •     Step 8  Now register to Associate with Twitter Account 


This Article Help us to Authenticate our MVC Application with Twitter 


Write reference,

Page copy protected against web site content infringement by Copyscape

About the Author

Rama Sagar
Full Name: RamaSagar Pulidindi
Member Level: Silver
Member Status: Member,MVP
Member Since: 12/30/2012 1:51:40 AM
Country: India
A Software Profesional working in Microsoft .NET technologies since year 2008, and I work for Dake ACE. I am passionate about .NET technology and love to contribute to the .NET community at Dot Net Funda

Login to vote for this post.

Comments or Responses

Login to post response

Comment using Facebook(Author doesn't get notification)