Suddenly getting 401 Errors, don't know why

oauth

#1

Hi all,

My application suddenly started throwing 401 errors: Authentication credentials were missing or incorrect. Nothing has changed with the application – the Java code is the same, the Twitter app’s callback URL has been set, and the system clock is in sync.

After some digging, I read that being rate-limited can also cause 401 Errors. Since this is my first time using the Twitter API, I might have inadvertently called the API too many times in my Java code. I think I have fixed that issue. If I am indeed rate-limited/IP banned from using the Twitter API, how will I know?

For what it’s worth, I can call GET /application/rate_limit_status just fine. However, doing any POST requests throw an exception. Also, when creating an app on Twitter, the HTML title of the page says “Access Denied”, but I can still create the app.

Any help is appreciated. Thanks.


#2

Is there any associated error code/message with it or just the header?

https://dev.twitter.com/overview/api/response-codes


#3

401:Authentication credentials (https://dev.twitter.com/pages/auth) were missing or incorrect. Ensure that you have set valid consumer key/secret, access token/secret, and the system clock is in sync. {“request”:"/1.1/friendships/create.json",“error”:“Read-only application cannot POST.”}


#4

That “error” field explains the problem. On your app you need to change the settings to ask for write access as well.


#5

Solved. Twitter had restricted my IP address, and the API team was able to resolve the issue.