Skip to content

Instantly share code, notes, and snippets.

@maxcountryman
Created March 17, 2013 01:09
Show Gist options
  • Save maxcountryman/5179090 to your computer and use it in GitHub Desktop.
Save maxcountryman/5179090 to your computer and use it in GitHub Desktop.
(defn get-access-token
"Retrieves an access token."
[this & [req]]
(let [client-creds {:client_id (:client-id this)
:client_secret (:client-secret this)}
url (:access-token-url this)
method (or (:method req) "POST") ;; default to "POST"
is-entity-method (in? method entity-methods)
req (merge req (if is-entity-method
{:form-params client-creds}
{:query-params client-creds}))]
(client/check-url! url)
(client/request (merge req {:method (keyword (lower-case method))
:url url}))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment