login and register also stores a http-only cookie

This commit is contained in:
strNophix 2022-09-30 16:45:42 +02:00
parent 21f3a3d000
commit c3d610cbf7
2 changed files with 14 additions and 0 deletions

View File

@ -42,5 +42,12 @@ func Login(ctx *fiber.Ctx) error {
return err
}
ctx.Cookie(&fiber.Cookie{
Name: "accessToken",
Value: token,
HTTPOnly: true,
SameSite: "Strict",
})
return ctx.JSON(LoginResponse{Token: token})
}

View File

@ -41,5 +41,12 @@ func Register(ctx *fiber.Ctx) error {
return err
}
ctx.Cookie(&fiber.Cookie{
Name: "accessToken",
Value: token,
HTTPOnly: true,
SameSite: "Strict",
})
return ctx.JSON(LoginResponse{Token: token})
}