Auth: POST /api/v1/auth/logout — чистит HttpOnly cookie

This commit is contained in:
ga 2026-08-20 22:13:20 +00:00
parent 0c1de393d2
commit 6e2a54820e

View File

@ -193,6 +193,14 @@ func main() {
api.Post("/auth/register", registerLimiter, authH.Register)
api.Post("/auth/login", loginLimiter, authH.Login)
api.Post("/auth/logout", func(c *fiber.Ctx) error {
// чистим cookie
c.Cookie(&fiber.Cookie{
Name: "buhapp_at", Value: "", Path: "/",
MaxAge: -1, HTTPOnly: true, Secure: true, SameSite: "Lax",
})
return c.JSON(fiber.Map{"ok": true})
})
protected := api.Group("", auth.Middleware(authSvc))
protected.Get("/me", h.GetMe)