Fork me on GitHub
#ring
<
2017-11-23
>
magra08:11:37

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.

jumar08:11:15

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

jumar08:11:01

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

magra08:11:44

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

magra08:11:29

Now I get a state mismatch 😉

sova-soars-the-sora19:11:16

@magra did you figure it out 😄?