if you're seeing this then I managed to toot from Clojure. \o/

(http/post
(str (uri/join (:host @toot-cat) "/api/v1/statuses"))
{:form-params {:status "if you're seeing this then I managed to toot from Clojure. \o/"}
:headers "Authorization" (str "Bearer " access-token)})

Sweet! That actually worked :D :D

Had to poke around in both the Mastodon and the Doorkeeper sources to figure out this OAuth flow but I managed.

Did it with plain clj-http, might try again using clj-oauth now that I get it.

Here's the code https://gist.github.com/plexus/789814cf2bd4dd57c8f1b738d68e7b1e

Lessons learned

- OAuth2 is fidgety af (no news there, really)
- include redirect_uri everywhere, even though it's only used once
- when creating the app it's redirect_uris and scopes (both plural), in the auth link it's both singular
- lots of 422 or 401 with no meaningful error message whatsoever. Luckily I could run a local instance to debug.

@plexus congrats! Emoticon Rich Hickey approves 8&:-D

Was getting an access token straightforward?

@henry look at my other toots, I posted the source. Wasn't too bad in hindsight, but you have to get the details right, and the errors aren't very helpful.
@plexus ah, thanks for letting me know. Amaroq won't let me see toots before my single-user instance started following you. I'll switch over to the website and do my homework