          :body (html
                 [:body
                  [:h1 "Azondi MQTT Broker API Server"]
-                 [:p "The application with client id " (-> req :query-params (get "client_id"))
+                 [:p "The application with client id " (get-session-value req  "session-id" (:session-store this) :client-id)
                   " is requesting access to the Azondi API on your behalf. Please login if you are happy to authorize this application."]
                  [:form {:method :post
                          :action (path-for (:modular.bidi/routes req) ::post-authenticate-form)}

                  [:p
                   [:label {:for "password"} "Password"]
                   [:input {:name "password" :id "password" :type "password"}]]

                  ;; TODO - Hidden fields - I think we should first
                  ;; redirect to a oauth2 handler which validates the
                  ;; request, if the request is valid, then tries to
                  ;; authenticate the user against an existing session,
                  ;; if no existing session then redirects to a login
                  ;; form such as this. Then we wouldn't need to 'hide'
                  ;; these fields in the form.
                  [:input {:name "client_id" :type "hidden" :value (-> req :query-params (get "client_id"))}]
                  [:input {:name "scope" :type "hidden" :value (-> req :query-params (get "scope"))}]
                  [:input {:name "state" :type "hidden" :value (-> req :query-params (get "state"))}]

                  [:p [:input {:type "submit"}]]
                  [:p [:a {:href (path-for (:modular.bidi/routes req) :cylon.impl.signup/signup-form)} "Signup"]]]])})
      wrap-params)

           (let [params (-> req :form-params)
                 identity (get params "user")
                 password (get params "password")
                 client-id (get-session-value req  "session-id" (:session-store this) :client-id)
                 scope (get-session-value req  "session-id" (:session-store this) :scope)
                 state (get-session-value req  "session-id" (:session-store this) :state)
                 scopes (set (str/split scope #"[\s]+"))
                 ;; Lookup application
                 {:keys [callback-uri] :as application}
