13
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Twitter の AccessToken と AccessTokenSecret を Ruby で取得する

Last updated at Posted at 2014-07-23
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}"
13
9
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?