Skip to content

Commit

Permalink
fix: set domain for cookie
Browse files Browse the repository at this point in the history
- without an explicit domain, cookie is not properly set in development mode
  • Loading branch information
cgawron committed Oct 19, 2024
1 parent b22fce6 commit ff919ee
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion backend/src/controller/authentication_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,10 @@ export const googleLoginController = (req: Request, res: Response): void => {
);

const sameSite = process.env.NODE_ENV === 'development' ? 'none' : 'strict';
const domain = process.env.DOMAIN || "appoint.gawron.cloud";
res
.cookie('access_token',
access_token, { maxAge: 60 * 60 * 24 * 1000, httpOnly: true, secure: true, sameSite })
access_token, { maxAge: 60 * 60 * 24 * 1000, httpOnly: true, secure: true, sameSite, domain })
.status(200)
.json({
user: { _id, email, name, picture_url: picture },
Expand Down

0 comments on commit ff919ee

Please sign in to comment.