Hi @Scaramaccai, If you are starting out, it's always best to keepthings as bare as possible until you discover a better way.
If as you say you can save the usr/pwd, and the decision to keep or replace the token is entirely left to the token provider, then I think something like the following may be suitable. For anyone interested in learning the ins and outs of OO vs Functional, static typing vs. dynamic, I highly recommend the Programming Languages Specialization on Coursera. (defonce user-tokens (atom {:users {})) (defn get-updated-token [usr pwd tok] ;; Returns tok if still valid or a new token if expired/expiring. ) (defn get-token [usr, psw] (let [f (fn f [tok] [tok, (fn [] (f (get-updated-token usr psw tok)))]) path [:users usr] [tok thunk] (or (get-in @user-tokens path) (f nil))] (first (swap! user-tokens assoc-in path (thunk))))) (defn geturl [url] (client/get url {:oauth-token (get-token "user" "pwd")})) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/clojure/60edfcb9-6d33-4ce7-959d-24a8286815a2%40googlegroups.com.