"undefined is not a function" on jwt.sign
See original GitHub issueCode:
jwt = require('express-jwt'),
var token = jwt.sign( { id: user._id }, secret.secretToken, { expireInMinutes: tokenManager.TOKEN_EXPIRATION } )
Error:
var token = jwt.sign( { id: user._id }, secret.secretToken, { expireInMinut
^
TypeError: undefined is not a function
Issue Analytics
- State:
- Created 9 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
TypeError: jwt.sign is not a function - Stack Overflow
When I enter john.doe and foobar in a form, I get told by console that jwt.sign is not a function, even after an...
Read more >[Solved]-TypeError: jwt.sign is not a function-node.js
Coding example for the question TypeError: jwt.sign is not a function-node.js.
Read more >Implementing JWT Authentication in Node.js
In this post, we will learn how to implement JWT (JSON Web Token) based authentication in Node.js, and build a complete server application ......
Read more >Node.js Express: JWT example | Token Based Authentication ...
To process Authentication & Authorization, we have these functions: - check if token is provided, legal or not. We get token from x-access-token...
Read more >ReferenceError: jwt is not defined(jsonwebtoken error)
const token= jwt. sign ({ ^ ReferenceError: jwt is not defined at D:\programming\nodejs\expressjs\routerHandler\userHandler.js:49:30 [nodemon] ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This fix the issue for me.
const { expressjwt: jwt } = require("express-jwt");
Seems you could just as easily export the sign method from the already included jsonwebtoken module so that this module could provide that, no?