   (request-handlers [this]
     {::authorize
      (-> (fn [req]
-        ;; TODO Establish whether the user-agent is already authenticated.
-        ;; If not, create a session with client-id, scope and state and redirect to the login form
-        (if-let [session
-                 (get-session
-                  (:session-store this)
-                  (-> req cookies-request :cookies (get SESSION-ID) :value))]
-          ;; TODO Obey the 'prompt' value in OpenID/Connect
-          (do
-            (infof "Hi - it appears you're already logged in, session is %s" (pr-str session))
-            {:status 302
-             :headers {"Location" (path-for (:modular.bidi/routes req) ::get-authenticate-form)}})
-          (let [session (create-session!
-                         (:session-store this)
-                         {:client-id (-> req :query-params (get "client_id"))
-                          :scope (-> req :query-params (get "scope"))
-                          :state (-> req :query-params (get "state"))
-                          })]
-            (infof "Hi - it appears you're not already logged in, so I'm going to create a session for you and redirect you")
-            (cookies-response
-                      {:status 302
-                       :headers {"Location" (path-for (:modular.bidi/routes req) ::get-authenticate-form)}
-                       :cookies {SESSION-ID (->cookie session)}}))))
+           ;; TODO Establish whether the user-agent is already authenticated.
+           ;; If not, create a session with client-id, scope and state and redirect to the login form
+           (let [session-id (-> req cookies-request :cookies (get SESSION-ID) :value)]
+             (infof "Session id is %s" session-id)
+             (if-let [session
+                      (get-session
+                       (:session-store this)
+                       session-id)]
+               ;; TODO Obey the 'prompt' value in OpenID/Connect
+               (do
+                 (infof "Hi - it appears you're already logged in, session is %s" (pr-str session))
+                 {:status 302
+                  :headers {"Location" (path-for (:modular.bidi/routes req) ::get-login-form)}})
+
+               (let [session (create-session!
+                              (:session-store this)
+                              {:client-id (-> req :query-params (get "client_id"))
+                               :scope (-> req :query-params (get "scope"))
+                               :state (-> req :query-params (get "state"))
+                               })]
+                 (infof "Hi - it appears you're not already logged in, so I'm going to create a session for you and redirect you")
+                 (cookies-response
+                  {:status 302
+                   :headers {"Location" (path-for (:modular.bidi/routes req) ::get-login-form)}
+                   :cookies {SESSION-ID (->cookie session)}})))))
          wrap-params)
 
-     ::get-authenticate-form
+     ::get-login-form
      (->
       (fn [req]
         {:status 200

                 [: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 client."]
                 [:form {:method :post
                         :action (path-for (:modular.bidi/routes req) ::post-authenticate-form)}
                  [:p
                   [:label {:for "user"} "User"]
                   [:input {:name "user" :id "user" :type "text"}]]

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

     ::post-login-form
     (-> (fn [req]
           (let [params (-> req :form-params)
                 identity (get params "user")
