I am writing a simple Login handler. Everything works just fine except setting the cookie.
Here is the code :
.
.
.
cookie := &http.Cookie{
Name: credentials.EmailAddress,
Value: sessionKey,
MaxAge: 600,
Path: "/",
Domain: "localhost",
Secure: false,
HttpOnly: false,
}
http.SetCookie(ctx.Writer, cookie)
SendResponse(ctx, Response{
Status: http.StatusOK,
Message: "successfully logged in",
})
return
I also tried with using Gin Gonic method, but same thing :
.
.
.
ctx.SetCookie("name", "value", 600, "/", "localhost", false, false)
SendResponse(ctx, Response{
Status: http.StatusOK,
Message: "successfully logged in",
})
return
I am not sure what am I doing wrong. I don't get the cookie nor in Postman nor in browser. If anybody knows the solution, thanks in advance.