I am using Echo for my web application. I tried to implement Login and Logout. When I tried to logout, its not clearing the session. Here is my code:
func Logout(c echo.Context) error {
sess, _ := session.Get("session", c)
sess.Options = &sessions.Options{
Path: "/",
MaxAge: -1,
HttpOnly: true,
}
sess.Values["username"] = ""
sess.Values["authenticated"] = ""
sess.Save(c.Request(), c.Response())
return c.Redirect(http.StatusSeeOther, "/")
}
After logout I checked the session values, its not changing or clearing anything. I am using these packages for session management:
"github.com/labstack/echo-contrib/session"
"github.com/gorilla/sessions"