Payload error in jsonwebtoken

后端 未结 7 2056
谎友^
谎友^ 2021-02-01 16:50

I am making a web application using nodejs and angular cli I\'m using JWT to authenticate my login function . But when I process it threw this error

Err

7条回答
  •  借酒劲吻你
    2021-02-01 17:35

    Change

    const token = jwt.sign(user, config.secret, { expiresIn: 10080 });
    

    To

    const token = jwt.sign(user.toJSON(), config.secret, { expiresIn: 10080 });
    

提交回复
热议问题