When using the Twitter API for use with Microsoft’s ASP.NET Identity, which is the replacement for the old SQL Membership API. 

After you create your app details on twitter. You plug in the consumerKey and consumerSecret in your AuthConfig.cs file.

When you try to login via your web application you get “The remote server returned an error: (401) Unauthorized”. It means that there is a issue with the credentials you have supplied.

For me, since I was working locally and didn’t have a domain name yet. It seamed that you need to put something, anything, in the Application settings Callback URL field. Localhost did not work, neither putting in a dummy domain. What did work is http://127.0.0.1. Now run you app and try to login via twitter. No more error.

Just be sure when you app is live to change the Callback URL field.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This Post Has 3 Comments

  1. Lily

    Hello, Mark. I have read on Stackoverflow that ASP.NET is vbloated and unstable. How true is that? Can you recommend something as an alternative?
    I had the same issue, error 401. I have tried contacting IT guys and posted to Twitter developers and finally found a solution – it turned out that I did not have a request token being sent to oauth/authorize.

    1. Mark Perry

      I don’t think asp.net is unstable at all.

    2. manoj

      Lily,

      Can you please let me know what was the solution? We are facing similar issue.