From 6b9b5011a89b456211c4a11bf217508d23e1da50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kalle=20Blomstr=C3=B6m?= Date: Sun, 27 Mar 2016 00:18:25 +0100 Subject: [PATCH] Fixes bug when merging state-map. Also fixes not creating a token refresh thread when token is forever. --- src/loudmoauth/authflow.clj | 5 +++-- src/loudmoauth/core.clj | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/loudmoauth/authflow.clj b/src/loudmoauth/authflow.clj index b6cbfee..b2b0d92 100644 --- a/src/loudmoauth/authflow.clj +++ b/src/loudmoauth/authflow.clj @@ -85,8 +85,9 @@ [provider-auth-data] (when-let [token-refresher (:token-refresher provider-auth-data)] (future-cancel token-refresher)) - (when-let [expiry-time (:expires_in provider-auth-data)] - (assoc provider-auth-data :token-refresher (token-refresher expiry-time)))) + (if-let [expiry-time (:expires_in provider-auth-data)] + (assoc provider-auth-data :token-refresher (token-refresher expiry-time)) + provider-auth-data)) ;TODO If oauth-token is not set, do the initial call. If it is already set do a refresh call. ; By doing it this way we don't have to distinguish between grant_type outside get-tokens. diff --git a/src/loudmoauth/core.clj b/src/loudmoauth/core.clj index 4bde477..1a94cab 100644 --- a/src/loudmoauth/core.clj +++ b/src/loudmoauth/core.clj @@ -52,7 +52,6 @@ (lma/add-response-type "code" params) params) (lma/add-state) - (merge old-app-state) (swap! lma/app-state assoc provider)))) ;Here we either supply our key or don't. If no key, just return (first tokens)