title: Asp.Net MVC 5 Owin Twitter Auth throwing 401 Exception
body: <p>I have set up OAuth authentication using the Owin middleware based off the default project that gets created when starting a new Web project using "Individual accounts" authentication. </p>
  
  <p>I've tweaked it a bit, but Facebook and Google are working great, however, when I click on the "twitter" button to issue the challenge, it's throwing a 500 http exception with the error message:</p>
  
  <blockquote>
    <p>Response status code does not indicate success: 401 (Unauthorized).</p>
  </blockquote>
  
  <p>This only comes up with Twitter.  Here is my auth config:</p>
  
  <pre><code>// Just a configuration section that reads from the web.config
  var configuration = new OwinCookieConfigurationSection("owinCookieConfiguration");
  app.UseCookieAuthentication(GetCookieAuthenticationOptions(configuration));
  app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
  
  app.UseTwitterAuthentication(
      consumerKey: "XXX",
      consumerSecret: "XXX"
  );
  
  app.UseFacebookAuthentication(
      appId: "XXX",
      appSecret: "XXX"
  );
  
  app.UseGoogleAuthentication();
  </code></pre>
  
  <p>It's definitely a 500 error, not a 401 error as it indicates and I have confirmed it never makes it passed the original post challenge to Twitter.  The stack trace appears to show Twitter is not returning a success code from the ObtainRequestToken call:</p>
  
  <p><img src="https://i.stack.imgur.com/0WUWY.png" alt="Stack Trace"></p>
  
  <p>Any ideas?</p>