question

AnujOscar-4952 avatar image
0 Votes"
AnujOscar-4952 asked

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

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-graph-sdk
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

0 Answers