When trying to authenticate a Twitter account using the Twitter and OAuth modules, I get the following error

Could not obtain a valid token from the Twitter API. Please review the configuration.

I have since found that The following error is recorded in Watchdog

exception 'TwitterException' with message 'Unauthorized' in /var/www/html/sitex/public/sites/all/modules/twitter/twitter.lib.php:151 Stack trace: #0 /var/www/html/sitex/public/sites/all/modules/twitter/twitter.lib.php(114): Twitter->request('https://api.twi...') #1 /var/www/html/sitex/public/sites/all/modules/twitter/twitter.lib.php(51): Twitter->auth_request('https://api.twi...', Array) #2 /var/www/html/sitex/public/sites/all/modules/twitter/twitter.pages.inc(343): Twitter->get_request_token()


Having checked out the URL which is generated and sent off by drupal_http_request I get the following error message

Failed to validate oauth signature and token

I have checked the following

  • Followed https://drupal.org/node/1346824
  • Reinstalled both the Twitter and OAuth modules
  • Ensured my OAuth Consumer key is correct
  • Ensured my OAuth Consumer secret is correct
  • Ensured I have Read & Write permissions
  • Ensured my server time is within 5 minutes of Twitter's as per this thread
  • Ensured my server is running extension=php_openssl.dll
  • Ensured my callback URL is correct - http://mywebsite.com/twitter/oauth

    Note that I am not on localhost, nor is my host behind .htaccess

Visiting my callback URL results in the following error at /admin/config/services/twitter

The connection to Twitter failed. Please try again.

  • I am not on localhost, but have tried the suggested callback URL regardless.
  • I do a version compatible/containing "Patch 5" as mentioned here
  • I'm using the following versions of the modules

    • Twitter 7.x-6.0-alpha2+1-dev (But have tried 7.x-5.8 too)
    • OAuth 7.x-3.1
    • Core 7.22

I haven't enabled the following- Do I need to?

  • OAuth Provider UI
  • Twitter actions
  • Twitter Post
  • Twitter Signin

I'd appreciate it if anyoneis able to provide insight!


1 Answer 1


This just started working with no change- I can only assume it was a temporary problem with Twitter at the time.

To some degree a useless answer, but the question gives others a list of things to try in the same situation and allows me to mark this question as resolved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.