Skip to content

Commit

Permalink
fixed setting cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
ayush7801 committed May 18, 2024
1 parent e9ae1a7 commit 1031aec
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion backend/src/controller/userController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ const userSignup = async (req: Request, res: Response, next: NextFunction) => {
path: '/',
domain: Constants.DOMAIN_NAME,
signed: true,
sameSite: 'none',
secure: true,
expires: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000),
httpOnly: true
});
Expand Down Expand Up @@ -107,6 +109,8 @@ const userLogin = async (req: Request, res: Response, next: NextFunction) => {
path: '/',
domain: Constants.DOMAIN_NAME,
signed: true,
sameSite: 'none',
secure: true,
expires: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000),
httpOnly: true
});
Expand Down Expand Up @@ -182,7 +186,7 @@ const userLogout = async (req: Request, res: Response, next: NextFunction) => {
// User Logout
res.clearCookie(Constants.AUTH_COOKIE_NAME, {
path: '/',
domain: 'localhost',
domain: Constants.DOMAIN_NAME,
signed: true,
httpOnly: true
});
Expand Down

0 comments on commit 1031aec

Please sign in to comment.