   (:require [clojure.core.async :as a]
             [loudmoauth.authflow :as lma]))
 
-;TODO - Deal with errors and exceptions
-;TODO - Deal with missing :redirect-uri key, if that is possible?
-;TODO - Go over doc strings one more time.
-;TODO - How do we support several service-providers at the same time?
-
-;This is the handlers function to call after receiving callback to specified url.
-;TODO - Deal with cases where token is nil. If so don't put on channel.
-;TODO - What do we return here?
+;We need to identify what provider we are coming from here? 
+;Together with the code do we get our state? That's our key so that's good.
+;But how do we map a key to another key provided by our users.
 (defn parse-code
   "Parse code from http-response and deliver promise."
   [response]

      :code 
      (a/>! lma/code-chan))))

(defn refresh-token
  []
  "In case of emergency token refresh, we supply this function."
  (lma/get-tokens @lma/app-state))

(defn init
  "Init ouath token request cycle."
  []
  (let [old-app-state @lma/app-state] 
    (->>

      (reset! lma/app-state))))

;This is the handlers function to retrieve different kinds of dialog pages, nescessary for identification.
;Here we could be creative and add our key in the metadata of the interaction url or just return a map instead with our key and url.
(defn user-interaction
  "Prompt for user interaction."
  []
  (if-let [interaction-url (a/poll! lma/interaction-chan)]
    interaction-url
    "No user interaction nescessary."))

;We can totally get away with only rewriting this namespace, just make each function take a keyword as argument, no argument, give us first in list.
(defn set-oauth-params
  "Set oauth-parameters for use in call to get token"
  [params]
