public async Task <Unit> Handle(RevokeRefreshToken request, CancellationToken cancellationToken) { var token = request.Token; var userId = request.UserId; var refreshToken = await RefreshTokenRepository.GetAsync(token); if (refreshToken == null || refreshToken.UserId != userId) { throw new IdentityException(Codes.RefreshTokenNotFound, "Refresh accessToken was not found."); } refreshToken.Revoke(); await RefreshTokenRepository.UpdateAndSaveAsync(refreshToken); return(Unit.Value); }