Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StoreInSession calls Store.New creating a new session every time #527

Open
TomG-Mona opened this issue Nov 11, 2023 · 1 comment
Open

StoreInSession calls Store.New creating a new session every time #527

TomG-Mona opened this issue Nov 11, 2023 · 1 comment

Comments

@TomG-Mona
Copy link

err := gothic.StoreInSession("test", "test-value, req, res)
if err != nil {
	fmt.Println("error storing client in session: ", err)
            return
}

val, err := GetFromSession("test", req)
if err != nil {
	fmt.Println("error retrieving value for 'test' that was just set: ", err)
   }

  // GetFromSession fails 100% of the time
@tmstorm
Copy link

tmstorm commented Dec 23, 2023

I am having this same issue. For me it is setting the cookies path to the current path which deletes it right away.

If I manually set the path using the session store it will set a cookie and keep it. However if you try and call it again right after to populate the value it will reset the path.

StoreInSession("path", "/", r, w)

This will create a cookie with a path "/" and it will persist.

StoreInSession("value", "somevalue", r, w)

The previous cookie is overwritten and the current path written which deletes the cookie instantly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants