Share via

java.util.concurrent.ExecutionException: java.lang.Exception: Server returned error in RSTR - ErrorCode: FailedAuthentication : FaultMessage: Authentication Failure

Anuj Oscar 6 Reputation points
2021-08-24T19:39:20.737+00:00

We have created an Azure app and granted all required permissions for two different email ids but with one we are able to acquire the token and with the other we are getting below error. The email IDs have no any 3rd party authentication like Okta.

Why is the same app working for an email and not working for the other one?

// Code snippet
UserNamePasswordParameters parameters = getUserNamePasswordParameters(scopes, username, password);
Future<IAuthenticationResult> aResult = app.acquireToken(parameters);
IAuthenticationResult result = (IAuthenticationResult)aResult.get();

2021-08-24 14:03:41,785 ERROR [Thread-200] [com.microsoft.aad.msal4j.PublicClientApplication] [] [dd.trace_id= dd.span_id=] [Correlation ID: REMOVED] Execution of class com.microsoft.aad.msal4j.AcquireTokenByAuthorizationGrantSupplier failed.: java.lang.Exception: Server returned error in RSTR - ErrorCode: FailedAuthentication : FaultMessage: Authentication Failure
at com.microsoft.aad.msal4j.WSTrustResponse.parse(WSTrustResponse.java:88)
at com.microsoft.aad.msal4j.WSTrustRequest.execute(WSTrustRequest.java:48)
at com.microsoft.aad.msal4j.WSTrustRequest.execute(WSTrustRequest.java:70)
at com.microsoft.aad.msal4j.AcquireTokenByAuthorizationGrantSupplier.processPasswordGrant(AcquireTokenByAuthorizationGrantSupplier.java:76)
at com.microsoft.aad.msal4j.AcquireTokenByAuthorizationGrantSupplier.execute(AcquireTokenByAuthorizationGrantSupplier.java:33)
at com.microsoft.aad.msal4j.AuthenticationResultSupplier.get(AuthenticationResultSupplier.java:59)
at com.microsoft.aad.msal4j.AuthenticationResultSupplier.get(AuthenticationResultSupplier.java:17)
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1604)
at java.lang.Thread.run(Thread.java:748)

Microsoft Security | Microsoft Graph
0 comments No comments
{count} vote

Your answer

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