2

The remote server returned an error: (401) Unauthorized – Twitter API

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.

Click Here to Leave a Comment Below 2 comments
Lily - July 25, 2016

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.

Reply
    Mark Perry - August 9, 2016

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

    Reply

Leave a Reply: