2025-01-24 12:01:27 +01:00
|
|
|
package cookie
|
|
|
|
|
|
|
|
|
|
import (
|
2025-12-10 15:47:33 +01:00
|
|
|
"time"
|
|
|
|
|
|
2025-01-24 12:01:27 +01:00
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func AddAccessTokenCookie(c *gin.Context, maxAgeInSeconds int, token string) {
|
|
|
|
|
c.SetCookie(AccessTokenCookieName, token, maxAgeInSeconds, "/", "", true, true)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func AddSessionIdCookie(c *gin.Context, maxAgeInSeconds int, sessionID string) {
|
|
|
|
|
c.SetCookie(SessionIdCookieName, sessionID, maxAgeInSeconds, "/", "", true, true)
|
|
|
|
|
}
|
2025-12-10 15:47:33 +01:00
|
|
|
|
|
|
|
|
func AddDeviceTokenCookie(c *gin.Context, deviceToken string) {
|
|
|
|
|
c.SetCookie(DeviceTokenCookieName, deviceToken, int(15*time.Minute.Seconds()), "/api/one-time-access-email", "", true, true)
|
|
|
|
|
}
|