Skip to content

Commit

Permalink
fix:logout issue while hosting because of clear cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
Rithick574 committed Jul 10, 2024
1 parent 2d2cca3 commit 0739e11
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions auth-service/src/presentation/controllers/logout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,25 @@ import { IDependencies } from "../../application/interfaces/IDependencies";
import { Request, Response, NextFunction } from "express";

export const logoutController = (dependencies: IDependencies) => {
return async (req: Request, res: Response, next: NextFunction) => {
try {
res.cookie("access_token", "", {
maxAge: 1,
httpOnly: true,
secure: true,
sameSite: "none",
});

return async (req: Request, res: Response, next: NextFunction) => {
res.cookie("refresh_token", "", {
maxAge: 1,
httpOnly: true,
secure: true,
sameSite: "none",
});

try {

res.cookie("access_token", "", {
maxAge: 1
});

res.cookie("refresh_token", "", {
maxAge: 1
});

res.status(204).json({});

} catch (error) {
next(error);
}
res.status(204).json({});
} catch (error) {
next(error);
}
}
};
};

0 comments on commit 0739e11

Please sign in to comment.