(ns dummy-auth.oauth2.auth (:require [ring.util.response :as ruresp])) (defn handle [req] (let [redirect-uri (get-in req [:query-params "redirect_uri"]) state (get-in req [:query-params "state"]) redirection (cond (and (some? redirect-uri) (some? state)) (str redirect-uri "?state=" state "&code=abc") (some? redirect-uri) (str redirect-uri "?code=abc") :else "/error")] (println "oauth2/auth: redirecting to" redirection) (ruresp/redirect redirection)))