fix: set cookie Secure=true and SameSite=None for cross-origin auth

This commit is contained in:
Tiago Yamamoto 2026-02-23 13:44:34 -06:00
parent 5ce0980090
commit 3583ef89d8

View file

@ -121,8 +121,8 @@ func (h *CoreHandlers) Login(w http.ResponseWriter, r *http.Request) {
Path: "/",
Expires: time.Now().Add(24 * time.Hour),
HttpOnly: true,
Secure: false, // Set to true in production with HTTPS
SameSite: http.SameSiteLaxMode,
Secure: true,
SameSite: http.SameSiteNoneMode,
})
w.Header().Set("Content-Type", "application/json")
@ -143,8 +143,8 @@ func (h *CoreHandlers) Logout(w http.ResponseWriter, r *http.Request) {
Path: "/",
Expires: time.Now().Add(-24 * time.Hour), // Expire in the past
HttpOnly: true,
Secure: false, // Set to true in production with HTTPS
SameSite: http.SameSiteLaxMode,
Secure: true,
SameSite: http.SameSiteNoneMode,
MaxAge: -1, // Delete cookie immediately
})