Tumblr OAuth in Emacs
A week ago I complained that Tumblr API v1 is not supported anymore, and clients should use OAuth instead. The problem with OAuth is that it requires to setup a callback listener (Tumblr doesn't support out-of-band authorization unlike Twitter). It is not how most scripts and text editors are designed.
How to use it:
Register a new app; set "http://localhost:12345/" as callback URL, get the keys.
In Emacs Lisp, after you install etumblr:
(require 'etumblr) (setq access-token (etumblr-authorize-app "OAUTH-CONSUMER-KEY" "SECRET-KEY" 12345))
This will lead the user through the entire authorization process, and will get you the access token (if the user permits).
- Now, you can use the API v2. There is a small function, provided as
an example, to create new text posts on Tumblr:
(etumblr-post-text access-token "example.tumblr.com" "post title" "*markdown* _body_")
Works for me.
I am not an elisp guru, and didn't figure how to pass the verification code from an async callback handler without using a global var. That's ugly but should probably work for most users.
Now, if someone finds time to integrate it with emacs-tumblr, I’ll be happy.
(Posted with etumblr.el, obviously)
P.S. More on Tumblr and Emacs integration. I discovered that tumblesocks supports API v2 too.
Update: I stopped using Tumblr, and don't intend to improve this code.