ERR_CONNECTION_REFUSED in Android after redirect with MSAL

Hello,

I have an Ionic Angular application for Android, where I log my users using the Microsoft MSAL library.

I initially log them via loginRedirect, using the Capacitor InAppBrowser. However, once the user is logged in, I want to renew tokens in the background (using MsalService.ssoSilent). This will create an iFrame that will perform the necessary calls. Once these are handled, the iFrame will redirect back to the APP → This is where I’m currently having issues. I’ve set my redirectUri to “http://localhost/auth” (response I get = http://localhost/auth#code=…).

However, the redirect is never happing. When I check the iFrame, I get the following message: The webpage at http://localhost/auth#code=… could not be loaded because: net::ERR_CONNECTION_REFUSED.

I’m currently testing on an Android Emulator.

Has anybody come across a similar problem (and found a solution)?