UPDATE: try fix cookie
All checks were successful
Build and Release / release (push) Successful in 1m23s

This commit is contained in:
2026-03-31 17:39:36 +07:00
parent 7f589b4994
commit 58764a42ea

View File

@@ -61,16 +61,18 @@ func (h *AuthController) Signin(c fiber.Ctx) error {
Name: "access_token", Name: "access_token",
Value: res.AccessToken, Value: res.AccessToken,
HTTPOnly: true, HTTPOnly: true,
Secure: c.Protocol() == "https", Secure: true,
SameSite: "None", SameSite: "None",
Path: "/",
}) })
c.Cookie(&fiber.Cookie{ c.Cookie(&fiber.Cookie{
Name: "refresh_token", Name: "refresh_token",
Value: res.RefreshToken, Value: res.RefreshToken,
HTTPOnly: true, HTTPOnly: true,
Secure: c.Protocol() == "https", Secure: true,
SameSite: "None", SameSite: "None",
Path: "/",
}) })
return c.Status(fiber.StatusOK).JSON(response.CommonResponse{ return c.Status(fiber.StatusOK).JSON(response.CommonResponse{
@@ -114,16 +116,18 @@ func (h *AuthController) Signup(c fiber.Ctx) error {
Name: "access_token", Name: "access_token",
Value: res.AccessToken, Value: res.AccessToken,
HTTPOnly: true, HTTPOnly: true,
Secure: c.Protocol() == "https", Secure: true,
SameSite: "None", SameSite: "None",
Path: "/",
}) })
c.Cookie(&fiber.Cookie{ c.Cookie(&fiber.Cookie{
Name: "refresh_token", Name: "refresh_token",
Value: res.RefreshToken, Value: res.RefreshToken,
HTTPOnly: true, HTTPOnly: true,
Secure: c.Protocol() == "https", Secure: true,
SameSite: "None", SameSite: "None",
Path: "/",
}) })
return c.Status(fiber.StatusOK).JSON(response.CommonResponse{ return c.Status(fiber.StatusOK).JSON(response.CommonResponse{
@@ -159,16 +163,18 @@ func (h *AuthController) RefreshToken(c fiber.Ctx) error {
Name: "access_token", Name: "access_token",
Value: res.AccessToken, Value: res.AccessToken,
HTTPOnly: true, HTTPOnly: true,
Secure: c.Protocol() == "https", Secure: true,
SameSite: "None", SameSite: "None",
Path: "/",
}) })
c.Cookie(&fiber.Cookie{ c.Cookie(&fiber.Cookie{
Name: "refresh_token", Name: "refresh_token",
Value: res.RefreshToken, Value: res.RefreshToken,
HTTPOnly: true, HTTPOnly: true,
Secure: c.Protocol() == "https", Secure: true,
SameSite: "None", SameSite: "None",
Path: "/",
}) })
return c.Status(fiber.StatusOK).JSON(response.CommonResponse{ return c.Status(fiber.StatusOK).JSON(response.CommonResponse{
@@ -319,8 +325,9 @@ func (h *AuthController) GoogleLogin(c fiber.Ctx) error {
Value: state, Value: state,
Expires: time.Now().Add(15 * time.Minute), Expires: time.Now().Add(15 * time.Minute),
HTTPOnly: true, HTTPOnly: true,
Secure: c.Protocol() == "https", Secure: true,
SameSite: "None", SameSite: "None",
Path: "/",
}) })
url := h.oauth.AuthCodeURL(encoded) url := h.oauth.AuthCodeURL(encoded)
@@ -396,16 +403,18 @@ func (h *AuthController) GoogleCallback(c fiber.Ctx) error {
Name: "access_token", Name: "access_token",
Value: res.AccessToken, Value: res.AccessToken,
HTTPOnly: true, HTTPOnly: true,
Secure: c.Protocol() == "https", Secure: true,
SameSite: "None", SameSite: "None",
Path: "/",
}) })
c.Cookie(&fiber.Cookie{ c.Cookie(&fiber.Cookie{
Name: "refresh_token", Name: "refresh_token",
Value: res.RefreshToken, Value: res.RefreshToken,
HTTPOnly: true, HTTPOnly: true,
Secure: c.Protocol() == "https", Secure: true,
SameSite: "None", SameSite: "None",
Path: "/",
}) })
allowed := map[string]bool{ allowed := map[string]bool{