| 
					
				 | 
			
			
				@@ -1543,23 +1543,26 @@ namespace Emby.Server.Implementations.Session 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     Limit = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }).Items.FirstOrDefault(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var allExistingForDevice = _authRepo.Get( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                new AuthenticationInfoQuery 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    DeviceId = deviceId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                }).Items; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            foreach (var auth in allExistingForDevice) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (!string.IsNullOrEmpty(deviceId)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (existing == null || !string.Equals(auth.AccessToken, existing.AccessToken, StringComparison.Ordinal)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    try 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                var allExistingForDevice = _authRepo.Get( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    new AuthenticationInfoQuery 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        Logout(auth); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    catch (Exception ex) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        DeviceId = deviceId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }).Items; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                foreach (var auth in allExistingForDevice) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (existing == null || !string.Equals(auth.AccessToken, existing.AccessToken, StringComparison.Ordinal)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        _logger.LogError(ex, "Error while logging out."); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        try 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            Logout(auth); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        catch (Exception ex) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            _logger.LogError(ex, "Error while logging out."); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 |