   (revoke-one! [this [code]]
     (db/delete-authcode {:code code}))
   (store! [this k authcode]
-    (when (= 1 (db/insert-authcode authcode)) authcode))
+    (let [scope (join " " (:scope authcode))]
+      (when (= 1 (db/insert-authcode (assoc authcode :scope scope))) authcode)))
   (purge! [this]
     (db/clear-authcodes)))
 

    {:client-id client_id
     :login login
     :code code
     :scope scope
     :redirect-uri redirect_uri
     :expires-at expires_at
     :created-at created_at}))

             [store :refer :all]]
            [failjure.core :as f]
            [cerber.stores.user :as user]
            [cerber.error :as error]
            [clojure.string :refer [join split]]))

(defn default-valid-for []
  (-> app-config :authcodes :valid-for))
