add: Cookie generation
This commit is contained in:
20
internal/utils/cookies.go
Normal file
20
internal/utils/cookies.go
Normal file
@@ -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,
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user