Quantcast
Channel: Active questions tagged https - Stack Overflow
Viewing all articles
Browse latest Browse all 1634

Cookie is not getting stored after login

$
0
0

Error occuring in cookie set after deployment

import jwt from "jsonwebtoken";const createJWT = (res, userId) => {  const token = jwt.sign({ userId }, process.env.JWT_SECRET, {    expiresIn: "1d",    sameSite: "none",  });  res.cookie("token", token, {    httpOnly: true,    secure: process.env.NODE_ENV !== "development", // Use secure cookies in production    sameSite: "none", // Prevent CSRF attacks    maxAge: 1 * 24 * 60 * 60 * 1000, // 1 days  });};export default createJWT;

I have encountered an issue where the cookie isn't being set after login in my application. I've tried debugging the server-side code but haven't been able to identify the problem. I've also checked various Stack Overflow answers, but I'm still unsure about what steps to take next. If anyone has experienced a similar issue or has suggestions for further troubleshooting steps, I'd really appreciate the guidance.


Viewing all articles
Browse latest Browse all 1634

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>