Fork me on GitHub

Hello! I'm trying to use oauth2 lib with reitit. But for some reason the uri-redirection (from oauth2) doesn't work. There is the following note in the lib: Please note, you should enable cookies to be sent with cross-site requests, in order to make the callback request handling work correctly, eg:

(wrap-defaults handler (-> site-defaults (assoc-in [:session :cookie-attrs :same-site] :lax)))
which I thought it was the main suspect. After a long debug session I figured out that indeed, something went wrong with the session. Did some search in google and found this So, it seems that this is a reitit problem? I tried to apply any of the mentioned fixes but nothing worked. I use a default middleware this way (from here :
(defn site-defaults-middlewares
  (ring-mid-def/wrap-defaults handler (-> ring-mid-def/site-defaults
                                          (assoc-in [:security :anti-forgery] false)
                                          (assoc-in [:session :cookie-attrs :same-site] :lax))))
and I just have a github oauth2 middleware:
(defn github-oauth2-middleware
     {:authorize-uri    ""
      :access-token-uri ""
      :client-id        "client-id"
      :client-secret    "secret"
      :scopes            ["user:email"]
      :launch-uri       "/oauth2/github"
      :redirect-uri     "/oauth2/github/callback"
      :landing-uri      "/welcome"}}))
finally my routers are define this way (ring/ring-handler (ring/router [["/routes"..{:handler ...}......]] {:data {:middleware [midlewares here....]})))


Sorry for the long post, thanks in advance