开发者

Tumblr API 2: Where is the "OAUTH_TOKEN" and "OAUTH_TOKEN_SECRET"

I want to use Tumblr API 2, http://www.tumblr.com/docs/en/api/v2

I have already registered an Application here: http://www.tumblr.com/oauth/apps

But I only get the "OAuth Consumer Key" and "Secret Key". Where is the "OAUTH_TOKEN" and "OAUTH_TOKEN_SECRET"?

One program https://gist.github.com/12426开发者_运维问答62 needs these parameters:

class TumblrAPIv2:
    def __init__(self, consumer_key, consumer_secret, oauth_token, oauth_token_secret):
        self.consumer = oauth2.Consumer(consumer_key, consumer_secret)
        self.token = oauth2.Token(oauth_token, oauth_token_secret)
        self.url = "http://api.tumblr.com"


Probably this is old thread and you might have figured out how to work with it, Although I am trying to post the entire process for some newbies here, As it took a while for me to understand the entire process and work flow.

I have worked a lot with OAuth v2 and Tumblr API.

  1. First and foremost we need to get registered to tumblr and once its done you get CONSUMER KEY and SECRET. These are the initial set of keys for further process.

  2. After you have registerd and trying to communicate to the provider, we need request for REQUEST TOKEN and SECRET. This is one time access and it has nonce time attached to them. You can get that here (https://api.tumblr.com/console/calls/user/info).

  3. Once you have REQUEST TOKEN AND SECRET. At this point you have registered your application and granted requested access to provider. Now you need to authorize yourself with the provider using /authorize url. At this point you get back OAUTH TOKEN and OAUTH VERFIER.

  4. Once you have above tokens last step of this process is to fetch ACCESS TOKEN ANS TOKEN SECRET by apssing OAUTH TOKEN and CONSUMER KEY using /access/ url. After this step is succesfull you have ACCESS TOKEN.

  5. Now store your CONSUMER KEY AND SECRET from first step and ACCESS TOKEN AND TOKEN SECRET from 4th step somewhere safe and use these keys in future for any communication to the provider.

NOTE: 1. Its generally assumed that access token expire but in reality they don't expire. They will expire only if user revokes the access. 2. After you have your token you can change your login credentials of Tumblr any number of times, this WILL NOT EFFECT the keys fetched.

I hope this is helpful for someone looking for the process and myths and questions regarding the process.


The steps given by @Shilpa are now automated here. Go to that page and input your consumer_key & consummer_secret. You'll get back oauth_token & oauth_token_secret.


Those OAuth Token and Token Secret come from the registration process. This code assumes that the user is already registered and has authorized your application with Tumblr. You can find code that walks you through the registration/authorization process on Google Code.


Please look in to this URL and please select appropriate API Language ( Java or Python or other )

https://api.tumblr.com/console/calls/user/info

It'll shows your consumer_key/consumer_secret/oauth_token/oauth_token_secret


Yes, Tumblr API Docs suck -- they don't have the OAuth explained and force you to use their libraries.


Having CONSUMER_KEY and CONSUMER_SECRET you get oauth_token and oauth_token_secret from https://www.tumblr.com/oauth/request_token

Then if you want to make calls authorized by a user you lead him to https://www.tumblr.com/oauth/authorize?oauth_token=... where he gets oauth_verifier for you -- you now use it to get oauth_token and oauth_token_verifier to use them instead of those oauth_ tokens that you got in the beginning.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜