Open nivaruofficial opened 9 years ago
The problem is in Express response, it returns a json version of the jwt token Go to your session controller in the post action and inside the bcrypt.compare() callback find and remove this line
res.json(token);
And put this one instead
res.send(token);
This way the jwt token won't have double quoting.
Hi, i've fixed the issue of double quoting with the following code:
var auth = req.headers['x-auth']; auth = auth.replace(/"([^"]+(?="))"/g, '$1'); auth = jwt.decode(auth, config.secret);
I wonder why it happens!