Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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/1242662 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"
like image 776
DocWiki Avatar asked Oct 05 '11 18:10

DocWiki


1 Answers

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.

like image 153
Shilpa Avatar answered Sep 24 '22 19:09

Shilpa