Created
March 17, 2013 01:09
-
-
Save maxcountryman/5179090 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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