                (:uid user) =not=> nil?)
 
          (fact "user email stays in the session after validating token"
-               (get-in response [:session :user :email]) => user-email)))+               (get-in response [:session :user :email]) => user-email)))

(facts "about token endpoint"
       (let [user-email "email@user.com"
             user (storage/store-user! user-email "password")
             client-details (client/register-client "MYAPP" "myapp.com")
             auth-code (auth-code/create-auth-code client-details user "callback")
             request (-> (r/request :get "/token")
                         (assoc :params {:grant_type   "authorization_code"
                                         :redirect_uri "callback"

       (fact "user-email and access_token in session stay in session if user is logged in"
             (let [user-email "email@user.com"
                   user (storage/store-user! user-email "password")
                   client-details (cl-client/register-client "MYAPP" "myapp.com")
                   access-token (cl-token/create-token client-details user)
                   request (-> (r/request :post "/authorisation")
                               (assoc :params {:client_id (:client-id client-details) :response_type "code" :redirect_uri "callback"})
                               (assoc-in [:session :access_token] (:token access-token))
