Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
October 14, 2021 12:42 am GMT

Cannot read property 'jwtoken' of undefined

Cannot read property 'jwtoken' of undefined

0

here I generate the token at backend in express..............

router.post("/login",async(req,res)=>{    const {email,password}=req.body;    if(!email || !password){        return res.status(401).send({error:"please filled the data properly"});    }    try {        const loginUser=await User.findOne({email:email});        if(!loginUser){            return res.status(400).send({error:"not found"});        }        const isMatch = await bcrypt.compare(password,loginUser.password);            if(isMatch){            const token=await loginUser.generateToken();            res.cookie("jwtoken",token,{                expires:new Date(Date.now()+15000000),                httpOnly:true,                //secure:true  //it

Original Link: https://dev.to/suvamray/cannot-read-property-jwtoken-of-undefined-jik

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To