(coffee) => code

Twitter API: 401 Unauthorized

Symptom: Twitter API returns a 401 Unauthorized when you start the OAuth process by obtaining a bearer token. This can happen all of a sudden possibly breaking existing processes that were working.

Problem: The most likely culprit is the clock on your server. If this gets out of sync (even by as little as 20s), Twitter’s amazing API will barf and return a helpful “401 Unauthorized”


sudo ntpdate ntp.ubuntu.com