I'm trying to implement Passport.JS and JWT functionality into my nodejs application and receive the following error
TypeError: fn is not a function
in this code block of my application
const utils = require('./utils')
const strategies = require('./strategies')
const pipe = (...functions) => args => functions.reduce((arg, fn) => fn(arg), args)
const initialiseAuthentication = app => { utils.setup() pipe(strategies.JWTStrategy)(app)
}
module.exports = { utils, initialiseAuthentication, strategies }Would be awesome if someone could guide me in the right direction, as I am stuck here. Thank you a lot.
1 Answer
Found the issue myself. In the /strategies/index.js file I was exporting the strategy like so module.exports = { strategy }, but was calling pipe(strategies.JWTStrategy)(app) in the code snippet.
It has to be pipe(strategies.strategy)(app).