Tumblr API 2:“OAUTH_TOKEN”在哪里?和“OAUTH_TOKEN_SECRET”

发布于 2024-12-08 12:06:27 字数 723 浏览 0 评论 0原文

我想使用 Tumblr API 2,http://www.tumblr.com/docs/en/api/v2< /a>

我已经在这里注册了一个应用程序: http://www.tumblr.com/oauth/apps

但我只获取“OAuth Consumer Key”并且“秘密钥匙”。 “OAUTH_TOKEN”和“OAUTH_TOKEN_SECRET”在哪里?

一个程序 https://gist.github.com/1242662 需要以下参数:

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"

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"

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

痴情 2024-12-15 12:06:27

也许这是旧线程,您可能已经知道如何使用它,尽管我试图在这里为一些新手发布整个过程,因为我花了一段时间才理解整个过程和工作流程。

我经常使用 OAuth v2 和 Tumblr API。

  1. 首先,我们需要注册到 tumblr,完成后您将获得消费者密钥和秘密。这些是用于进一步处理的初始密钥集。

  2. 在您注册并尝试与提供商通信后,我们需要请求请求令牌和秘密。这是一次性访问,并且附加了随机数时间。您可以在这里获取(https://api.tumblr.com/console/calls/user /info)。

  3. 一旦您获得请求令牌和秘密。此时,您已经注册了您的应用程序并授予了提供商所请求的访问权限。现在您需要使用 /authorize url 向提供商授权。此时,您将获得 OAUTH TOKEN 和 OAUTH VERFIER。

  4. 一旦您拥有上述令牌,此过程的最后一步就是通过使用 /access/ url apssing OAUTH TOKEN 和 CONSUMER KEY 来获取 ACCESS TOKEN ANS TOKEN SECRET。此步骤成功后,您将拥有访问令牌。

  5. 现在将第一步中的消费者密钥和密码以及第四步中的访问令牌和令牌秘密存储在安全的地方,并在将来使用这些密钥与提供商进行任何通信。

注意: 1. 通常假设访问令牌会过期,但实际上它们不会过期。仅当用户撤销访问权限时它们才会过期。
2. 获得令牌后,您可以多次更改 Tumblr 的登录凭据,这不会影响获取的密钥。

我希望这对寻找流程以及有关流程的神话和问题的人有所帮助。

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.

青柠芒果 2024-12-15 12:06:27

@Shilpa 给出的步骤现在此处已自动化。转到该页面并输入您的 consumer_key & consumer_secret。您将得到oauth_token & oauth_token_secret

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.

三五鸿雁 2024-12-15 12:06:27

这些 OAuth Token 和 Token Secret 来自注册过程。此代码假定用户已经注册并已通过 Tumblr 授权您的应用程序。您可以在 Google 代码上找到引导您完成注册/授权流程的代码。

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.

筱果果 2024-12-15 12:06:27

请查看此 URL 并选择适当的 API 语言(Java 或 Python 或其他)

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

它会显示您的
消费者密钥/消费者秘密/oauth_token/oauth_token_secret

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

高跟鞋的旋律 2024-12-15 12:06:27

是的,Tumblr API 文档很糟糕——他们没有解释 OAuth,并强迫你使用他们的库。


有了 CONSUMER_KEYCONSUMER_SECRET,您可以从 https://www.tumblr.com 获取 oauth_tokenoauth_token_secret /oauth/request_token

然后,如果您想拨打由用户授权的电话,您可以引导他https://www.tumblr.com/oauth/authorize?oauth_token=... 他为您获取 oauth_verifier ——您现在用它来获取 oauth_tokenoauth_token_verifier 使用它们代替您一开始获得的 oauth_ 令牌。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文