require "oauth"
consumer_key = "YOUR_KEY"
consumer_secret = "YOUR_SECRET"
consumer = OAuth::Consumer.new consumer_key, consumer_secret, site: "https://api.twitter.com"
request_token = consumer.get_request_token
puts "Please visit here: #{request_token.authorize_url}"
STDERR.print "Then put your PIN: "
access_token = request_token.get_access_token oauth_verifier: gets.chomp
puts "Token: #{access_token.token}"
puts "Secret: #{access_token.secret}"
More than 5 years have passed since last update.
Twitter の AccessToken と AccessTokenSecret を Ruby で取得する
Last updated at Posted at 2014-07-23
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme