Strange Mist behaviour workaround

This commit is contained in:
kagel 2016-09-30 01:52:40 +03:00
parent 2f6a835bba
commit 4a009a09e8
1 changed files with 3 additions and 4 deletions

View File

@ -26,10 +26,9 @@
(let [resp (github/post-for-token code state)
body (keywordize-keys (codec/form-decode (:body resp)))
access-token (:access_token body)]
(if-let [error (:error body)]
(:body
(error-page {:status 401
:title error}))
(if (:error body)
;; Why does Mist browser sends two redirects at the same time? The latter results in 401 error.
(response/redirect "/")
(let [user (get-or-create-user access-token)]
(-> (response/redirect "/")
(assoc :session {:identity user})))))))