How to fix com.microsoft.aad.msal4j.MsalClientException: Unable to establish loopback connection

Murali Radhakrishnan 0 Reputation points
2024-09-02T14:27:42.06+00:00

Hi,

Getting below exception when application tries to authenticate. Not much clear with this trace

java.util.concurrent.CompletionException: com.microsoft.aad.msal4j.MsalClientException: Unable to establish loopback connection

at com.microsoft.aad.msal4j.AuthenticationResultSupplier.get(AuthenticationResultSupplier.java:110)

at com.microsoft.aad.msal4j.AuthenticationResultSupplier.get(AuthenticationResultSupplier.java:18)

at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1604)

at java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1596)

at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)

at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)

at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)

at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175)

Caused by: com.microsoft.aad.msal4j.MsalClientException: Unable to establish loopback connection

at com.microsoft.aad.msal4j.HttpListener.startListener(HttpListener.java:29)

at com.microsoft.aad.msal4j.AcquireTokenByInteractiveFlowSupplier.startHttpListener(AcquireTokenByInteractiveFlowSupplier.java:99)

at com.microsoft.aad.msal4j.AcquireTokenByInteractiveFlowSupplier.getAuthorizationResult(AcquireTokenByInteractiveFlowSupplier.java:64)

at com.microsoft.aad.msal4j.AcquireTokenByInteractiveFlowSupplier.execute(AcquireTokenByInteractiveFlowSupplier.java:46)

at com.microsoft.aad.msal4j.AuthenticationResultSupplier.get(AuthenticationResultSupplier.java:69)

... 7 common frames omitted  

Using below dependency

<dependency>
    <groupId>com.microsoft.azure</groupId>
    <artifactId>msal4j</artifactId>
    <version>1.16.2</version>
</dependency>

Appreciate the help!!

Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
6,425 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.