To handle authentication pop-ups, verify its appearance and then handle them using an explicit wait command.
Use the explicit wait command
WebDriverWait wait = new WebDriverWait(driver, 10);
Alert class is used to verify the alert
Alert alert = wait.until(ExpectedConditions.alertIsPresent());
Once verified, provide the credentials
alert.authenticateUsing(new UserAndPassword(<username>, <password>));