MCPcopy Create free account
hub / github.com/chainjet/platform / logout

Method logout

apps/api/src/auth/controllers/auth.controller.ts:72–87  ·  view source on GitHub ↗
(@Req() req: Request, @Res() res: Response, @Session() session: Record<string, any>)

Source from the content-addressed store, hash-verified

70 @UseGuards(NotAuthRequiredCookieGuard)
71 @Post('logout')
72 async logout(@Req() req: Request, @Res() res: Response, @Session() session: Record<string, any>) {
73 if (req.user) {
74 const user = req.user as User
75 const nonce = (req as any).nonce as string
76 if (user && nonce && user.nonces.includes(nonce)) {
77 user.nonces = user.nonces.filter((un) => un !== nonce)
78 await this.userService.updateById(user._id, { nonces: user.nonces })
79 }
80 }
81 try {
82 session.destroy(() => {})
83 } catch {}
84 res.clearCookie('cj-token', { path: '/', domain: '.chainjet.io' })
85 res.send({ success: true })
86 return { ok: true }
87 }
88
89 @Post('delete-cookie')
90 async deleteCookie(@Res() res: Response) {

Callers

nothing calls this directly

Calls 1

sendMethod · 0.80

Tested by

no test coverage detected