Closed yordis closed 3 years ago
I found something
I added
@session_options [
store: :cookie,
key: "_hello_key",
signing_salt: "CXlmrshG"
]
plug(Plug.Session, @session_options)
Or manually
conn(:get, "/oauth/simple-provider/callback", id: "foo", code: "simple-code")
|> Plug.Session.call(@session_options) # need this!
|> Ueberauth.run_callback(
"simple-provider",
{Support.SimpleProvider, [token_prefix: "token-"]}
)
And then I call Plug.Conn.fetch_session/1
defp get_state_cookie(conn) do
conn
|> Conn.fetch_session()
|> Map.get(:cookies)
|> Map.get(@state_param_cookie_name)
end
Do people suppose to call Plug.Conn.fetch_session/1
in their code in order to avoid such a problem?
I would like to figure out the documentation for this.
Plug.Conn..fetch_session/1
before they try to access the cookie when they are building custom Plugs (also vs Phoenix environments I guess)@josevalim any help on the topic? I am not sure the valid answers to them other than my isolated experience
@josevalim 🚀 thank you so much!
Hey there,
I tried to figure out what I suppose to do to fix this issue, but the more I google the more I create an infinite loop to the same links and I don't understand how to fix it.
I am working in Ueberauth (https://github.com/ueberauth/ueberauth/pull/136), add CSRF attack protection, but my test cases keeps failing:
I assume there is some plug or something but I am stock, and I need help at this point.
Thanks in advance,
Related to: https://github.com/ueberauth/ueberauth/pull/136