Liking cljdoc? Tell your friends :D

Clojure MAuth Client

Build Status

Leiningen/Boot Coords:

[clojure-mauth-client "1.0.5"]

Here it is folks, a nice, clean MAuth client done in the simplest and most minimal way possible, for your Clojure application.

There are a minimal set of dependencies (Bouncy Castle isn't one of them!), it is fast, and can even be used as middleware for securing your applications.

You do NOT need to jump through hoops to use this library. Simple is as simple does.


Either use the built jar, or lein jar to build one based on source.


First, you need to give the library your App UUID, MAuth Private Key and MAuth Service URL.

You can do this by defining the environment variables APP_UUID, MAUTH_KEY and MAUTH_SERVICE_URL respectively.

Or, you may do this programmatically by calling credentials/define-credentials with the respective parameters.

You can make an MAuth call by requiring the request namespace and either doing get!, post!, delete! or put! with the necessary parameters. These are the most common verbs in use out there, but its easy to extend support to other verbs as needed (PRs welcome!). If the verb you want isn't in the namespace, you can also make a call to request/make-request and specify your action directly. It is possible to do a macro for this stuff, but I am not a big fan of that approach for this case, because you lose IDE support, and it will appear as undefined there, which is annoying.

Full example (standard usage):

(ns your-app.core
  (:require [clojure-mauth-client.request :as mauth]
            [ :as json]))

;either your app has to have the APP_UUID, MAUTH_KEY, and MAUTH_SERVICE_URL predefined in env...
;or... you can call define-credentials...

;do the call!
(-> (mauth/get! "" "/api/v2/testing.json")

Middleware Usage:

(ns your-app.handler
  (:require [clojure-mauth-client.middleware :refer [wrap-mauth-verification]]))
  (-> #'app-routes
            (wrap-routes middleware/wrap-formats)

Yep, it really is that simple!

Recently, it has come to my attention that cloudflare or cloudfront URLs (ie. api-gateway) were not supported due to SNI configuration in the load balancer. Welp, not anymore! To do your calls with SNI, pass :with-sni? true to your calls.

For example, (mauth/get! "" "/api/v2/testing.json" :with-sni? true)

Contributing/ Tests

Tests can be run using lein test.

Contributions are welcome by Pull Request, and we welcome and encourage that!


Copyright © 2018 Medidata Solutions

This Library is licensed under the MIT licensing terms. See for details

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close