ring

magra 2017-11-23T08:17:37.000097Z

Ok. That was late yesterday and the wrap choking might be due to me pasting in a string. Today I can rephrase: How do I nest the ring middleware to get oauth2 working? With this code

(let [settings (-> site-defaults
                   (assoc-in [:session :cookie-attrs :same-site] :lax))]
  (run-jetty
   (wrap-oauth2 (wrap-params (wrap-defaults handler settings)) authmap) 
   {:port 3000}))
ring-oauth2/wrap-oauth2 receives the request with :query-string set but no :params. So in ring-oauth2/get-access-token sends a request to the google Server with code set to nil.

jumar 2017-11-23T08:21:15.000253Z

@magra try putting wrap-params to the outermost level. (using threading macro put it as the last middleware in your run-jetty)

jumar 2017-11-23T08:22:01.000106Z

this is the source for wrap-params:

(fn [request]
    (handler (params-request request options))))
you can see that it makes params available to the handler it wraps

magra 2017-11-23T08:38:44.000210Z

@jumar thanks!!! That solves the params problem!

magra 2017-11-23T08:40:29.000276Z

Now I get a state mismatch 😉

sova-soars-the-sora 2017-11-23T19:41:16.000057Z

@magra did you figure it out 😄?