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) badRequest(res, result.message)
} else { } else {
res res
.cookie('token', result.token, { .cookie('knedita_token', result.token, {
httpOnly: true, httpOnly: true,
secure: process.env.NODE_ENV === 'production', secure: process.env.NODE_ENV === 'production',
}) })

View file

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

View file

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