14
14

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.

RubyでTumblrのOAuth認証のアクセストークンを得る手順

Posted at

前回、RubyでTwitterのOAuth認証のアクセストークンを得る手順
でTwitterでは無事OAuth成功したのだが、Tumblrで試したらできない、、、

と、思ったらできた。https://api.tumblr.comとすべきところを、http://api.tumblr.comにしてた…

require 'oauth'
require 'oauth/consumer'

@consumer=OAuth::Consumer.new( "CONSUMER_KEYを記入","CONSUMER_SECRETを記入", {
    :site=>"https://api.tumblr.com"
    })
    
@request_token=@consumer.get_request_token
@request_token.authorize_url

で、表示されたURLにアクセスするとoauth_verifierがURLについてくるので控えておく。(これがPINか)

@access_token = @request_token.get_access_token(:oauth_verifier => 'ここにoauth_verifierを記入')
puts @access_token.token
puts @access_token.secret

で、ACCESS_TOKENACCESS_SECRETをそれぞれ控える。

以上!

続きはこれとかでもにょもにょ。
https://github.com/codingjester/tumblr_client

14
14
1

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
14
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?