Skip to content

Commit

Permalink
Adding sameSite as server
Browse files Browse the repository at this point in the history
  • Loading branch information
nidhish-nayak committed Mar 23, 2024
1 parent 2e385e4 commit 5ab5a7e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions server/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ const config = {
// supabaseDirectUrl: process.env.DB_DIRECT_URL,
},
jwtKey: process.env.JWT_SECRET_KEY || "invalid_key",
server:
process.env.NODE_ENV === "production"
? process.env.SERVER_DOMAIN
: "localhost",
corsOptions: {
origin:
process.env.NODE_ENV === "production"
Expand Down
5 changes: 3 additions & 2 deletions server/src/controllers/auth/login.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ export const login = async (req: Request, res: Response) => {
const token = jwt.sign({ id: userId }, jwtKey);
return res
.cookie("accessToken", token, {
httpOnly: true,
secure: true,
sameSite: "none",
secure: true,
httpOnly: true,
domain: config.server,
// set 1 day token expiry
maxAge: 24 * 60 * 60 * 1000,
})
Expand Down

0 comments on commit 5ab5a7e

Please sign in to comment.