#req.logout is not a functionTypeError: req.logout is not a function
1 messages · Page 1 of 1 (latest)
This is one of those things when using fastify with passport. The standard documented approach doesn't work directly because fastify wraps the request object
I get this error: ERROR [ExceptionsHandler] req.raw.logout is not a function
TypeError: req.raw.logout is not a function
Well, was hoping that would do it. You do call the passport middleware functions, right? Initialize and session?
app.use(passport.initialize())
app.use(passport.session())
const fastifyApp = fastify();
fastifyApp.use() does not recognize it
Why are you doing fastifyApp? The app above should be the INestApplication
because I am working with fastify
I'm a nest application, right?
I don't understand you
Are you building a nest application, using fastify as the http engine, or is this just fastify?
just fastify
Oh, then I've got no clue. You should be able to use the middleware, but I don't work with fastify directly. This server is generally NestJS support
when I place
app.use(passport.initialize())
app.use(passport.session())
I try to access the path where this login gives me the error:
ERROR [ExceptionsHandler] Login sessions require session support. Did you forget to use express-session middleware?
Well, did you read and understand that error?
How are you doing session management?
yes and I have just placed
app.register(fastifySession, {
secret: 'asasaasas',
});
app.use(passport.initialize());
app.use(passport.session());
correct?
i don't work with fastify directly. Anytime I do it's through Nest
How would the correction be made?
I guess I'll have to put this in plain English: I don't know because I don't use fastify directly. This server is meant to be support for NestJS
If I had to guess, you need to await the register
I managed to fix that piece now when I place:
req.raw.logout();
it tells me :
req#logout requires a callback function
Error: req#logout requires a callback function