0

I'm trying to migrate a custom based controller API based on express to TSOA framework. I was using passport to handle authentication before.

How can I use it with TSOA? It seems to be ignored.

Matteo
  • 57
  • 1
  • 9

1 Answers1

0

I think that you need just to add app.use(passport.authenticate('jwt')); above RegisterRoutes(app); in your (propbaly) server.ts file.

Like this:

// ...
// passport.use('jwt',new JWTStrategy({<your_data_here>}));
// passport.initialize();
app.use(passport.authenticate('jwt'));
RegisterRoutes(app);
// ...
// const httpServer = createServer(app);
// httpServer.listen(82811, () => {
//   console.log(`Server is running at http://localhost:82811`);
// });
rakso
  • 35
  • 1
  • 5