clj-oauth provides OAuth client support for Clojure programs.
This is a maintained fork of drone29a/clj-oauth,
published as net.clojars.savya/clj-oauth. It releases the previously unreleased
HMAC-SHA256 support and moves onto current, security-supported dependencies
(BouncyCastle jdk18on, clj-http 3.13, Clojure 1.12).
deps.edn:
net.clojars.savya/clj-oauth {:mvn/version "1.6.1"}
Leiningen:
[net.clojars.savya/clj-oauth "1.6.1"]
Build the jar:
clojure -T:build jar
Deploy to Clojars:
clojure -T:build deploy
clojure -M:test
This runs the deterministic unit tests without credentials or network access.
The live Twitter tests are tagged ^:integration and skipped by default.
(require '[oauth.client :as oauth])
(def consumer
(oauth/make-consumer <consumer-token>
<consumer-token-secret>
"https://api.twitter.com/oauth/request_token"
"https://api.twitter.com/oauth/access_token"
"https://api.twitter.com/oauth/authorize"
:hmac-sha1))
(def request-token (oauth/request-token consumer <callback-uri>))
(oauth/user-approval-uri consumer (:oauth_token request-token))
(def access-token-response
(oauth/access-token consumer request-token <verifier>))
(def user-params {:status "posting from #clojure with #oauth"})
(def credentials
(oauth/credentials consumer
(:oauth_token access-token-response)
(:oauth_token_secret access-token-response)
:POST
"https://api.twitter.com/1.1/statuses/update.json"
user-params))
(http/post "https://api.twitter.com/1.1/statuses/update.json"
{:query-params (merge credentials user-params)})
Development funded by LikeStream LLC (Don Jackson and Shirish Andhare).
Designed and developed by Matt Revelle. Contributions from Richard Newman.
Maintenance fork (2026) by Savyasachi; original: drone29a/clj-oauth.
Copyright © 2009 Matt Revelle.
Distributed under the BSD 2-Clause License, preserving the original license.
Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |