add logout
This commit is contained in:
2
main.go
2
main.go
@@ -5,7 +5,7 @@ import (
|
|||||||
"astra-api-gateway/handler"
|
"astra-api-gateway/handler"
|
||||||
"astra-api-gateway/mw"
|
"astra-api-gateway/mw"
|
||||||
"astra-api-gateway/services/events"
|
"astra-api-gateway/services/events"
|
||||||
medical_information "astra-api-gateway/services/medical-information"
|
"astra-api-gateway/services/medical-information"
|
||||||
"astra-api-gateway/services/personal-information"
|
"astra-api-gateway/services/personal-information"
|
||||||
"astra-api-gateway/services/store"
|
"astra-api-gateway/services/store"
|
||||||
"astra-api-gateway/services/users"
|
"astra-api-gateway/services/users"
|
||||||
|
|||||||
@@ -43,10 +43,12 @@ func Login(c echo.Context) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
c.SetCookie(&http.Cookie{
|
c.SetCookie(&http.Cookie{
|
||||||
Name: "accessToken",
|
Name: "accessToken",
|
||||||
Value: _token,
|
Value: _token,
|
||||||
Path: "/",
|
Path: "/",
|
||||||
Expires: time.Now().Add(24 * time.Hour),
|
Expires: time.Now().Add(24 * time.Hour),
|
||||||
|
Secure: true,
|
||||||
|
SameSite: 4,
|
||||||
})
|
})
|
||||||
|
|
||||||
return c.JSON(http.StatusOK, u)
|
return c.JSON(http.StatusOK, u)
|
||||||
@@ -54,10 +56,12 @@ func Login(c echo.Context) (err error) {
|
|||||||
|
|
||||||
func Logout(c echo.Context) error {
|
func Logout(c echo.Context) error {
|
||||||
c.SetCookie(&http.Cookie{
|
c.SetCookie(&http.Cookie{
|
||||||
Name: "accessToken",
|
Name: "accessToken",
|
||||||
Value: "",
|
Value: "",
|
||||||
Path: "/",
|
Path: "/",
|
||||||
Expires: time.Unix(0, 0),
|
Expires: time.Unix(0, 0),
|
||||||
|
Secure: true,
|
||||||
|
SameSite: 4,
|
||||||
})
|
})
|
||||||
return c.NoContent(http.StatusOK)
|
return c.NoContent(http.StatusOK)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user