I have a Ruby on Rails application that works fine on my computer and on my server. I am moving this application to another server that runs on a different hosting service, and I am having a problem with the OAuth Ruby Gem.
Any request that I use using the OAuth harness gets:
OAuth::Unauthorized (401 Unauthorized):
oauth (0.4.3) lib/oauth/consumer.rb:217:in `token_request'
oauth (0.4.3) lib/oauth/consumer.rb:139:in `get_request_token'
...
My code is:
def self.consumer
OAuth::Consumer.new("XXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "YYYYYYYYYYYYYYYYYYYYYYYYYYYY", {:site => "http://api.twitter.com"})
end
def create_authorize_url
@request_token = UserController.consumer.get_request_token(:oauth_callback => "http://mysite.com/callback")
session[:request_token] = @request_token.token
session[:request_token_secret] = @request_token.secret
redirect_to @request_token.authorize_url
end
The problem is that the same code works well on my computer and on other servers. This only happens on one server. Anything related to the firewall or something that can block OAuth calls?
I searched a lot for this error, and I didn’t have an answer, and therefore I ask about it here.
Thank.