angularjs $ cookieStore SyntaxError:JSON.parse:意外字符
你有什么想法,为什么我得到一个错误
SyntaxError:JSON.parse:意外字符
在这个代码上
console.log($cookieStore.get('XSRF-TOKEN'));
cookie值是
kscJcqrDYSMdZtBleuq8yUrB
?
更新节点代码
var currentSession = req.session.passport; var user = currentSession.user; res.cookie('USER',JSON.stringify(user) , { maxAge: 900000, httpOnly: false});
$ cookieStore是序列化会话存储。 它给你的错误,因为cookie的价值没有序列化。
您的价值需要$ cookies 。