Gin securecookie: base64 decode failed

I am trying to set and read a secure server-side Cookie. Can’t see what I’m doing wrong. Decoding gives me error securecookie: base64 decode failed - caused by: illegal base64 data at input byte 203
perhaps it’s the % sign at this position

I created a very simple app to demonstrate my problem:

In I try to write a

tokens := map[string]string{
		"access_token":  "test_at",
		"refresh_token": "test_rt"}

in the “Login” function and then read it in the “GetSomething” handler function.

The actual cookie stuff is encapsulated here:

Error occurs in “GetCookie” Line 48

Am I doing it wrong?

Well I’m not saying this is a bug, since I’m no expert, just a GO beginner…

I switched to this implementation and it works as intended:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.