I'm having trouble logging into the server to do the authentication tests for my JWT password token, it claims problem
no " required:jwt({"
I tried changing the commas but the problem persisted I believe it is something deeper
CodePudding user response:
You should require the library with a different syntax, reading documentation:
const { expressjwt: jwt } = require("express-jwt")
Also, it looks that the algorithms
property is a required option. Therefore, on line 20 and 25 of your code, you want to write something like:
jwt({secret:'secret', algorithms: ["HS256"], userProperty: 'payload', getToken: getTokenFromHeader)
The above example just works. Of course you should choose the right strategy and the right algorithm for a strong authentication.
CodePudding user response:
const { expressjwt: jwt } = require("express-jwt");