Why does Twitter keep expiring my tokens?



This is similar to: Code: 89: Invalid or expired token: Constant on only some accounts

In the past couple of days, I’m able to use a newly-generated token for my account for one request (for a data set) before it’s being expired. Generating a new key hasn’t helped, either–this seems to be at the account level.

And “expired” means the Code 89 error is being returned after the second API call, and then in the Apps web UI, the app key remains, but the token is simply gone–deleted.

This is occurring with one small account, but not another, yet both are doing the exact same thing.


  • I am not exceeding daily limits–I know these well by now, and stay within the acceptable parameters. :slight_smile:
  • I am not making requests too quickly–there’s a healthy pause between each request, and both this and the above have been fine for a long time, for this and my other small account as mentioned (and when that happens, it’s obvious anyway–both in API responses and in the App UI, where a red flag has appeared in the past)
  • My client library also throttles requests per window, so it’s normal for a single operation on a small set to take 30-40 minutes, along with the delay mentioned for each single request per account unfollow–that’s okay

Any idea what’s happening here? I don’t think one of the more generic answers/common pitfalls explains the situation, as I’ve tried to cover above.

This sequence has been working fine for quite some time, but even then I do feel like this one account has been stigmatized in some way over time, compared to the other (regardless of new keys/tokens).

As mentioned, I’m being careful to “abide” and not hit limits both stated and unstated. :roll_eyes:

And I’ve also waited and tried again the next day, giving time for the air to clear in case the Twitter has become angry with me (in some way it fails to communicate) in a particular 24-hour period.

Update: Today it simply won’t work at all. After an ‘expired token’ message, I’ve obtained a new one and it is caused to expire almost immediately. I’ve only done one action in the current day, so I don’t believe this is related to any of the usual limits (and again, I know these).

So I have an account that has not been flagged visibly (in the way I’ve seen accounts labeled on twitter.com), I have an app that has not been flagged visibly in the apps console, yet my tokens are being made to expire immediately. In other words, this account is apparently no longer able to use the Twitter API to unfollow, despite working within all the stated and supposed limits.

My other account is doing the exact same thing (same script, different key/token), and working fine.

What am I supposed to do here, Twitter?

Code: 89: Invalid or expired token: Constant on only some accounts

I’m having the same exact problem, a year later.

I have several twitter accounts. only 2 of them have this problem. My app has been approved. I keep re-authorizing, but they almost immediately have their tokens invalidated. Meanwhile the rest of the accounts run for days without problems or the need to re-authorize.

Also, no notifications that I’m doing anything against the rules.

Did you ever find an answer?


Can you please provide the app IDs with which you are experiencing this issue?


Sorry for the delay!

My app ID is 15917082


I’m honestly not quite sure why this is happening to you. My best guess is that this might be happening due to spammy behavior.

Sorry I can’t help you much more than this.


I think I figured out it was probably my mistake in that my app was trying to use the deprecated User Stream. I’ll see if my change fixed my problem.