tumblr / pytumblr

A Python Tumblr API v2 Client
Apache License 2.0
723 stars 196 forks source link

Authentication failure #84

Closed karlinnolabs closed 7 years ago

karlinnolabs commented 7 years ago

As I don't have a consumer key or consumer secret as I can't seem to find either on the tumblr site I've set up my authentication like so.

client = pytumblr.TumblrRestClient( 'oauth key', 'oauth secret' )

This doesn't seem to work, so the question is where do I get the other keys? or are they not necessary as I suspected?

ceyko commented 7 years ago

@karlinnolabs You should be able to retrieve your Consumer Key and Consumer Secret from the OAuth Apps page. If you do not see your application there, you may also register for one.

Once you have the Consumer Key and Secret, you need to use them to complete an OAuth 1.0a flow with tumblr to get the OAuth Token and OAuth Secret. You can use any OAuth 1.0a library of your choosing to do so.

Or, if you just need a single token for your user for debug/development purposes, you can go to https://api.tumblr.com/console and enter your credentials. You should then be able to click the Show Keys button on the top right to get a full set of OAuth credentials. Or, you can click the Python tab, and copy and paste the code you see to get started using pytumblr.

However, please note that the generated OAuth token is specifically for your user anyone who has access to that token has full access to modify your user, blog, and posts, so be careful how you use it. In production you'll likely want to direct each user through an OAuth flow themselves, so you can access their user instead.


Also, note that if you're application only requires logged-out data ("API Key" authentication routes), you only need to supply the Consumer Key as the first parameter in the constructor, and can skip everything else mentioned.

karlinnolabs commented 7 years ago

I have the oauth keys but not the consumer key and secret, so instead of 4 strings I only have two.