diff --git a/internal/utils/cookies.go b/internal/utils/cookies.go new file mode 100644 index 0000000..1305fb3 --- /dev/null +++ b/internal/utils/cookies.go @@ -0,0 +1,20 @@ +package utils + +import ( + "net/http" + + "github.com/gin-gonic/gin" +) + +func SetCookie(c *gin.Context, token string) { + c.SetSameSite(http.SameSiteLaxMode) + c.SetCookie( + "jwt", + token, + 5*24*60*60, // 5 days + "/", + "", + true, + true, + ) +}