OAuth gives me 401 error
Posted
by Radek
on Stack Overflow
See other posts from Stack Overflow
or by Radek
Published on 2010-04-10T08:26:34Z
Indexed on
2010/04/10
8:33 UTC
Read the original article
Hit count: 621
I am trying to get the access key but I cannot make it work. `request_token.get_access_token
is giving me 401 Unauthorized (OAuth::Unauthorized)
error. I copy the authorize_url into my browser, allow the application, I receive some kind of PIN from twitter but after hitting enter in my script I always get 401 error. I did some search and I found this helped access_token = request_token.get_access_token(:oauth_verifier => params[:oauth_verifier])
but it is giving me undefined local variable or method
params' for main:Object (NameError)`
the ruby script is like ( I was following this tutorial )
gem 'oauth'
require 'oauth/consumer'
consumer_key = 'your key'
consumer_secret ='your secret'
consumer=OAuth::Consumer.new "consumer_key",
"consumer_secret",
{:site=>"http://twitter.com"}
#{:site=>"https://agree2.com"}
request_token = consumer.get_request_token
puts request_token.token
puts request_token.secret
puts request_token.authorize_url
puts "Hit enter when you have completed authorization."
STDIN.gets
access_token = request_token.get_access_token
#access_token = request_token.get_access_token(:oauth_verifier => params[:oauth_verifier])
puts access_token.token
puts access_token.secret
puts
puts access_token.inspect
© Stack Overflow or respective owner