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