diff --git a/src/oauth/strava.clj b/src/oauth/strava.clj new file mode 100644 index 0000000..042400a --- /dev/null +++ b/src/oauth/strava.clj @@ -0,0 +1,21 @@ +(ns oauth.strava + (:require [oauth.v2 :as oauth]) + (:gen-class)) + +(def ^:dynamic *oauth-authorize-url* "https://www.strava.com/oauth/authorize") +(def ^:dynamic *oauth-access-token-url* "https://www.strava.com/oauth/token") +(def ^:dynamic *strava-endpoint-url* "https://www.strava.com/api/v3/") +(def ^:dynamic *redirect-url* "http://localhost/") + +(defn oauth-authorize [key & redirect] + (oauth/oauth-authorize *oauth-authorize-url* key (or redirect *redirect-url*) :response-type "code")) + +(defn oauth-access-token [key secret code & redirect] + (oauth/oauth-access-token *oauth-access-token-url* + key + secret + code + (or redirect *redirect-url*))) + +(defn oauth-client [{:keys [access-token]}] + (oauth/oauth-client access-token)) diff --git a/src/oauth/v2.clj b/src/oauth/v2.clj index 859e18a..d152d36 100644 --- a/src/oauth/v2.clj +++ b/src/oauth/v2.clj @@ -25,7 +25,7 @@ "Returns the OAuth authorization url." [url client-id redirect-uri & {:as options}] (->> (assoc options :client-id client-id :redirect-uri redirect-uri) - (format-query-params) + format-query-params (str url "?"))) (defn oauth-authorize