exception 'TwitterException' with message 'Bad Request' I am trying to setup twitter module for Drupal 7 on my localhost. I followed the installation instructions as given in Twitter 7.x installation guide. I followed steps until "Add Twitter accounts" when i start getting this error.

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


The dblog has the following information:


  exception 'TwitterException' with message 'Bad Request' in
  C:\wamp\www\test_twitter\sites\all\modules\twitter\twitter.lib.php:142
  Stack trace: #0
  C:\wamp\www\test_twitter\sites\all\modules\twitter\twitter.lib.php(101):
  Twitter->request('https://api.twi...') #1
  C:\wamp\www\test_twitter\sites\all\modules\twitter\twitter.lib.php(51):
  Twitter->auth_request('https://api.twi...', Array) #2
  C:\wamp\www\test_twitter\sites\all\modules\twitter\twitter.pages.inc(336):
  Twitter->get_request_token() #3
  C:\wamp\www\test_twitter\includes\form.inc(1464):
  twitter_auth_account_form_submit(Array, Array) #4
  C:\wamp\www\test_twitter\includes\form.inc(860):
  form_execute_handlers('submit', Array, Array) #5
  C:\wamp\www\test_twitter\includes\form.inc(374):
  drupal_process_form('twitter_auth_ac...', Array, Array) #6
  C:\wamp\www\test_twitter\includes\form.inc(131):
  drupal_build_form('twitter_auth_ac...', Array) #7
  C:\wamp\www\test_twitter\sites\all\modules\twitter\twitter.pages.inc(130):
  drupal_get_form('twitter_auth_ac...') #8 [internal function]:
  twitter_user_settings() #9
  C:\wamp\www\test_twitter\includes\menu.inc(517):
  call_user_func_array('twitter_user_se...', Array) #10
  C:\wamp\www\test_twitter\index.php(21): menu_execute_active_handler()
  
  11 {main}


I also have oauth module installed as given in the requirements.

Additional info:


My machine accesses internet via a proxy server and i do have proxy settings given in settings.php file. Not sure why it should cause problems.
I was able to run twitter API commands using twitteroauth library in a standalone application. It was throwing errors before i gave it the proxy settings for curl.


Can anyone help?
I actually had a lot of trouble setting the Twitter module up on my localhost for testing, so I just created a blog post about how to set that up, that includes some tips on doing this with localhost: http://drupalwoo.wordpress.com/2013/04/22/how-to-show-tweets-from-your-twitter-account-on-your-drupal-website/

Here are the couple of things that I think my be relevant for you to check:


If you’re testing on localhost, use the following urls for your website and callback URLs (don’t worry, these are just placeholders, and your drupal site will send the correct callback URL when it connects):

Website URL: http://127.0.0.1:8000/twitter/oauth
Callback URL: http://127.0.0.1:8000/twitter/oauth

If you’re still getting errors when testing with localhost, make sure the version of the module you’re using has the patch #5 on this issue queue: http://drupal.org/node/1924478#comment-7260928 (if you have an older version of the module, prior to the incorporation of the patch, get the latest stable/dev release that includes it and uninstall and install the module)