           (initiate-authentication-interaction (:authenticator component) req {}))))
 
     ;; You are not authenticated, so let's authenticate first.
-    (do
-      (debugf "Not authenticated, must authenticate first with %s" (:authenticator component))
-      (let [auth-session
-            (create-session!
-             (:session-store component)
-             {:client-id (-> req :query-params (get "client_id"))
-              :requested-scopes (decode-scope (-> req :query-params (get "scope")))
-              :state (-> req :query-params (get "state"))
-              :response-type  "code"})]
-        (cookies-response-with-session
-         (initiate-authentication-interaction (:authenticator component) req {})
-         SESSION-ID auth-session)))))
+    (init-authentication component req)
+    ))
+
 
 
 (defrecord AuthorizationServer [store scopes iss]

    (s/with-fn-validation
      (h req))))



(defn authorize-client [session component req store]
  (if-let [auth-interaction-session-result (get-result (:authenticator component) req)]
    ;; the session can be authenticated or maybe we are

           ;; (Can we do this in a go block however?)

           (debugf "OAuth2 authorization server: Authorizing request")
           (if-not (exists? (:browser-session component) req)
            (init-authentication component req)
            (let [{response-type "response_type" client-id "client_id"} (:query-params req)
                  r-t (or response-type (get-data (:browser-session component) req :response-type))
                  ]
              (case r-t
                "code" (authorize-client
                        (get-data (:browser-session component) req)
                        component req store)

                ;; Unknown response_type
                {:status 400
                 :body (format "Bad response_type parameter: '%s'" response-type)}
                )
              )))
         wrap-params
         wrap-schema-validation)

