Good morning fellow devs, I am building a learnin...
# orm-help
d
Good morning fellow devs, I am building a learning app, where I am generating a JWT using
jsonwebtoken
npm package. It works fine for generation, but when in another mutation, I pass the token as an
HTTP Header - Authorization key
as Bearer <<token>>, it fails in a call to jwt.verify(). Error I get is -
JsonWebTokenError: invalid token at Object.module.exports [as verify]
Any ideas ?
I used same code in a sample Node app and tested the token with
jwt.verify()
method and it worked fine. Seems like some issue with GraphQL Playground ?
I was able to resolve it by removing "Bearer" from Authorization header in playground bottom panel. Wonder why it didn't work, because I was slicing off that "Bearer" string before passing it off to the function jwt.verify().