https://supertokens.com/ logo
#support-questions
Title
# support-questions
j

John Oliver

02/03/2023, 11:09 AM
Session issue I have this method in my nest app to verify the session:``` @Catch(STError) @Injectable() export class AuthGuard implements CanActivate { constructor(private readonly verifyOptions?: VerifySessionOptions) {} async canActivate(context: ExecutionContext): Promise { const ctx = context.switchToHttp(); let err = undefined; const resp = ctx.getResponse(); await verifySession(this.verifyOptions)( ctx.getRequest(), resp, (res) => (err = res) ); if (resp.headersSent) { throw new STError({ message: 'RESPONSE_SENT', type: 'RESPONSE_SENT', }); } if (err) { console.log({ status: false, message: 'Unauthorised' }); throw err; } return true; } }``` I have applied the
AuthGuard
on my method like this:``` @Post('/bulkAddUpdate') @UseGuards(new AuthGuard()) async bulkAddUpdate( @Body() bulkData: any, @Session() session: SessionContainer ) { console.log(session.getUserId()); // This logs nothing... const user = await this.applicationService.bulkAction(bulkData.data); if (user) { return utils.sendSuccess(SUCCESS.S200.DEFAULT, user); } else { throw new NotFoundException(); } }``` Upon signing in I am getting the front-token in the response headers and I am using that front-token to send the request in the postman as Bearer token, But I am getting unauthorised on every request on the above endpoint. Something is wrong but don't know what it is.