i am creating backend api and implementing token based authentication using jwt in nodejs. i am having following error when i try access the login route in postman
http://localhost:3000/authenticate
and the error is
Server listening on port 3000 events.js:160 throw er; // Unhandled 'error' event ^
TypeError: secret must be a string or buffer
at typeError (/Users/sohailawan-awok/portfolioapp/backend/node_modules/jwa/index.js:16:10)
at Object.sign (/Users/sohailawan-awok/portfolioapp/backend/node_modules/jwa/index.js:32:13)
at Object.jwsSign [as sign] (/Users/sohailawan-awok/portfolioapp/backend/node_modules/jws/lib/sign-stream.js:23:24)
at Object.module.exports [as sign] (/Users/sohailawan-awok/portfolioapp/backend/node_modules/jsonwebtoken/sign.js:146:16)
at /Users/sohailawan-awok/portfolioapp/backend/app/controllers/user.controller.js:56:21
at model.Query.<anonymous> (/Users/sohailawan-awok/portfolioapp/backend/node_modules/mongoose/lib/model.js:3683:16)
at /Users/sohailawan-awok/portfolioapp/backend/node_modules/kareem/index.js:273:21
at /Users/sohailawan-awok/portfolioapp/backend/node_modules/kareem/index.js:127:16
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
[nodemon] app crashed - waiting for file changes before starting...
via Sohail
No comments:
Post a Comment