Updated cookie name

This commit is contained in:
Hackntosh 2023-09-03 13:00:08 -03:00
parent af1cc94d8e
commit 81b0c05d68
3 changed files with 3 additions and 3 deletions

View file

@ -11,7 +11,7 @@ async function userAuthController(req: Request, res: Response): Promise<void> {
badRequest(res, result.message)
} else {
res
.cookie('token', result.token, {
.cookie('knedita_token', result.token, {
httpOnly: true,
secure: process.env.NODE_ENV === 'production',
})

View file

@ -6,7 +6,7 @@ async function userLogoutController(
): Promise<void> {
// @ts-expect-error clearCookie interface does not exists in Response.
return res
.clearCookie('token')
.clearCookie('knedita_token')
.status(200)
.json({ message: 'Successfully logged out' })
}

View file

@ -10,7 +10,7 @@ async function authenticated(
next: NextFunction,
): Promise<void> {
try {
const token = req.cookies.token
const token = req.cookies.knedita_token
if (token === undefined) {
unauthorized(res, 'Missing token')