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/mw"
|
||||
"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/store"
|
||||
"astra-api-gateway/services/users"
|
||||
|
||||
@@ -43,10 +43,12 @@ func Login(c echo.Context) (err error) {
|
||||
}
|
||||
|
||||
c.SetCookie(&http.Cookie{
|
||||
Name: "accessToken",
|
||||
Value: _token,
|
||||
Path: "/",
|
||||
Expires: time.Now().Add(24 * time.Hour),
|
||||
Name: "accessToken",
|
||||
Value: _token,
|
||||
Path: "/",
|
||||
Expires: time.Now().Add(24 * time.Hour),
|
||||
Secure: true,
|
||||
SameSite: 4,
|
||||
})
|
||||
|
||||
return c.JSON(http.StatusOK, u)
|
||||
@@ -54,10 +56,12 @@ func Login(c echo.Context) (err error) {
|
||||
|
||||
func Logout(c echo.Context) error {
|
||||
c.SetCookie(&http.Cookie{
|
||||
Name: "accessToken",
|
||||
Value: "",
|
||||
Path: "/",
|
||||
Expires: time.Unix(0, 0),
|
||||
Name: "accessToken",
|
||||
Value: "",
|
||||
Path: "/",
|
||||
Expires: time.Unix(0, 0),
|
||||
Secure: true,
|
||||
SameSite: 4,
|
||||
})
|
||||
return c.NoContent(http.StatusOK)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user