alexedwards / scs

HTTP Session Management for Go
MIT License
2.13k stars 166 forks source link

scs: no session data in context #64

Closed ThomasJunk closed 5 years ago

ThomasJunk commented 5 years ago

Abstract: Example code not working - resulting in stacktrace

Example used

At first, I suspected some issues with the filesystem (though /tmp should be writable). But even if you substitute the bolt examplecode by the memstore example code, the app crashes.

Operating system: Linux MYBOX 5.1.16-1-default #1 SMP Wed Jul 3 12:37:47 UTC 2019 (2af8a22) x86_64 x86_64 x86_64 GNU/Linux

Go Version: go version go1.12.6 linux/amd64

alexedwards commented 5 years ago

You need to wrap the mux (or the handler) with the LoadAndSave() middleware.

There's a basic example here: https://github.com/alexedwards/scs#basic-use

ThomasJunk commented 5 years ago

Oh, sorry for bothering you. 😳 Stupid me!! Typical beginner mistake. Thanks for taking the time!

alexedwards commented 5 years ago

No worries. Hope it's smooth sailing from here :-)

Koredeoluwafemi commented 3 years ago

I am having this issue on the go fiber framework, how and where do I pass in the http.handler into the LoadAndSave middleware