mirror of
				https://github.com/KevinMidboe/immich.git
				synced 2025-10-29 17:40:28 +00:00 
			
		
		
		
	chore(server): remove token when logged out (#1560)
* chore(mobile): invoke logout() on mobile app * feat: add mechanism to delete token from logging out endpoint * fix: set state after login sequence success * fix: not removing token when logging out from OAuth * fix: prettier * refactor: using accessTokenId to delete * chore: pr comments * fix: test * fix: test threshold
This commit is contained in:
		@@ -59,13 +59,18 @@ export class AuthController {
 | 
			
		||||
    return this.authService.changePassword(authUser, dto);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @Authenticated()
 | 
			
		||||
  @Post('logout')
 | 
			
		||||
  async logout(@Req() req: Request, @Res({ passthrough: true }) res: Response): Promise<LogoutResponseDto> {
 | 
			
		||||
  async logout(
 | 
			
		||||
    @Req() req: Request,
 | 
			
		||||
    @Res({ passthrough: true }) res: Response,
 | 
			
		||||
    @GetAuthUser() authUser: AuthUserDto,
 | 
			
		||||
  ): Promise<LogoutResponseDto> {
 | 
			
		||||
    const authType: AuthType = req.cookies[IMMICH_AUTH_TYPE_COOKIE];
 | 
			
		||||
 | 
			
		||||
    res.clearCookie(IMMICH_ACCESS_COOKIE);
 | 
			
		||||
    res.clearCookie(IMMICH_AUTH_TYPE_COOKIE);
 | 
			
		||||
 | 
			
		||||
    return this.authService.logout(authType);
 | 
			
		||||
    return this.authService.logout(authUser, authType);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user