Node-jsonwebtoken: JWT Decode retuning null even when Token is not null

Created on 24 Apr 2019  路  3Comments  路  Source: auth0/node-jsonwebtoken

JWT Decode is not working

I've tried everything I could

let user_id = jwt.decode(req.body.auth_token).id;

req.body.auth_token is not null, it's returning the token!

Most helpful comment

I was also receiving a null value when trying to use jwt.decode(token). Turns out I also needed to parse it jwt.decode(JSON.parse(token))

All 3 comments

It's working, I was passing token between ""

Same issue as in #587

I was also receiving a null value when trying to use jwt.decode(token). Turns out I also needed to parse it jwt.decode(JSON.parse(token))

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ehartford picture ehartford  路  3Comments

rynbyjn picture rynbyjn  路  5Comments

prevostc picture prevostc  路  4Comments

Sir-hennihau picture Sir-hennihau  路  4Comments

AndreOneti picture AndreOneti  路  3Comments