Code Monkey home page Code Monkey logo

ms-identity-java-desktop's Introduction

A desktop application in Java calling Microsoft Graph API

About these samples

Overview

Two samples are available:

  1. Java application letting users sign-in with username/password
  2. Java application which uses Integrated Windows Authentication to authenticate users signed into a domain joined or AAD joined machine

ms-identity-java-desktop's People

Contributors

avery-dunn avatar microsoft-github-operations[bot] avatar microsoftopensource avatar nanny07 avatar ramya25 avatar sangonzal avatar supernova-eng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ms-identity-java-desktop's Issues

tenant id missing

Where do I plug in the tenantid in this example in sample_cache.json. I am getting below error in the usernamePassword example
[ForkJoinPool.commonPool-worker-1] ERROR com.microsoft.aad.msal4j.PublicClientApplication - [Correlation ID: 5f9285a6-f2f4-4a95-b1f2-c45b45925620] Execution of class com.microsoft.aad.msal4j.AcquireTokenSilentSupplier failed.
com.microsoft.aad.msal4j.MsalClientException: Token not found it the cache
at com.microsoft.aad.msal4j.AcquireTokenSilentSupplier.execute(AcquireTokenSilentSupplier.java:58)
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(Unknown Source)
at java.util.concurrent.CompletableFuture$AsyncSupply.exec(Unknown Source)
at java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(Unknown Source)
at java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
at java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
[ForkJoinPool.commonPool-worker-1] ERROR com.microsoft.aad.msal4j.PublicClientApplication - [Correlation ID: 7c045e8c-3a86-43a4-88a3-4570aefa1813] Execution of class com.microsoft.aad.msal4j.AcquireTokenByAuthorizationGrantSupplier failed.
com.microsoft.aad.msal4j.MsalServiceException: AADSTS90019: No tenant-identifying information found in either the request or implied by any provided credentials.

What am I missing

Debugging the MSAL4J errors

I am using the MSAL4j library in my Java 11 Spring Boot web app to authenticate using the username password flow.

I use a service account (work account not personal) to authenticate, and this line:

result = pca.acquireToken(parameters).join();

throws the following error:

org.xml.sax.SAXParseException: The element type "br" must be terminated by the matching end-tag "</br>".
       at java.xml/com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:261) ~[na:na]
       at java.xml/com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339) ~[na:na]
       at java.xml/javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:122) ~[na:na]
       at com.microsoft.aad.msal4j.MexParser.getPolicy(MexParser.java:76) ~[msal4j-1.4.0.jar!/:1.4.0]
       at com.microsoft.aad.msal4j.MexParser.getWsTrustEndpointFromMexResponse(MexParser.java:112) ~[msal4j-1.4.0.jar!/:1.4.0]
       at com.microsoft.aad.msal4j.WSTrustRequest.execute(WSTrustRequest.java:62) ~[msal4j-1.4.0.jar!/:1.4.0]
       at com.microsoft.aad.msal4j.AcquireTokenByAuthorizationGrantSupplier.processPasswordGrant(AcquireTokenByAuthorizationGrantSupplier.java:76) ~[msal4j-1.4.0.jar!/:1.4.0]
       at com.microsoft.aad.msal4j.AcquireTokenByAuthorizationGrantSupplier.execute(AcquireTokenByAuthorizationGrantSupplier.java:33) ~[msal4j-1.4.0.jar!/:1.4.0]
       at com.microsoft.aad.msal4j.AuthenticationResultSupplier.get(AuthenticationResultSupplier.java:59) ~[msal4j-1.4.0.jar!/:1.4.0]
       at com.microsoft.aad.msal4j.AuthenticationResultSupplier.get(AuthenticationResultSupplier.java:17) ~[msal4j-1.4.0.jar!/:1.4.0]
       at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700) ~[na:na]
       at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]

based on this error alone, it is not possible for me to to decipher the cause of this issue is and how to debug/fix it.

Providing some debug logs or a more detailed error message would be helpful.

PS:
The code works fine as long as I am in the organization network (i.e. locally from my laptop on VPN), but when I deploy it to AWS kubernetes cluster which is outside my org network, it gives the above error.

NoClassDefFoundError: net/minidev/json/JSONAware

Hi, when trying to run the sample application, i am getting the NoClassDefFoundError: net/minidev/json/JSONAware in the MSAL library
com.microsoft.aad.msal4j.PublicClientApplication.(PublicClientApplication.java:124)

anyone found a workaround for this?

Federated user

I cannot make the application work for Guest (Federated users).
I tried using xxxx#EXT#@yyyy.onmicrosoft.com but It does not work.
Any idea?

Execution of class com.microsoft.aad.msal4j.AcquireTokenByAuthorizationGrantSupplier failed

I am using the Username Password flow sample code and getting the below exception while trying to get access token

ERROR com.microsoft.aad.msal4j.PublicClientApplication - [Correlation ID: 7b9d78c0-8f88-4864-81fb-44d5b06adc19] Execution of class com.microsoft.aad.msal4j.AcquireTokenByAuthorizationGrantSupplier failed.
java.net.MalformedURLException: no protocol:
at java.net.URL.(URL.java:610)
at java.net.URL.(URL.java:507)
at java.net.URL.(URL.java:456)
at com.microsoft.aad.msal4j.HttpHelper.executeHttpRequest(HttpHelper.java:36)
at com.microsoft.aad.msal4j.WSTrustRequest.execute(WSTrustRequest.java:65)
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:57)
at com.microsoft.aad.msal4j.AuthenticationResultSupplier.get(AuthenticationResultSupplier.java:17)
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590)
at java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1582)
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:157)
Exception in thread "main" java.util.concurrent.ExecutionException: java.net.MalformedURLException: no protocol:
at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1895)
at PublicClient.getAccessToken(PublicClient.java:74)
at PublicClient.main(PublicClient.java:53)
Caused by: java.net.MalformedURLException: no protocol:
at java.net.URL.(URL.java:610)
at java.net.URL.(URL.java:507)
at java.net.URL.(URL.java:456)
at com.microsoft.aad.msal4j.HttpHelper.executeHttpRequest(HttpHelper.java:36)
at com.microsoft.aad.msal4j.WSTrustRequest.execute(WSTrustRequest.java:65)
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:57)
at com.microsoft.aad.msal4j.AuthenticationResultSupplier.get(AuthenticationResultSupplier.java:17)
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590)
at java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1582)
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:157)

Sample Enhancements

  1. Demonstrated implementation on ITokenCacheAccessAspect does not make much sense.

Token cache is initialized from file with "dummy data", after it, in-memory "data" defined in TokenCacheAspect
is used. So file is used to read "dummy data" and it is never updated. That does not make sense.

Using in-memory cache defined in TokenCacheAspect is pointless, because MSAL application has its own in-memory token cache.

I do not think we should show how to implement persistent cache in scope of this sample, it is quite complicated and should :

demonstrate real use case ( as I explained current implementation does not make sense )
cover security
concurrency

So I believe it is enough to use in-memory cache for the purpose of this sample

  1. Application configurations should be in separate properties file,
    hardcoding config is anti pattern.

Sample doesn't work with Hybrid Identity with Federated Authentication

[ForkJoinPool.commonPool-worker-3] INFO com.microsoft.aad.msal4j.HttpHelper - [Correlation ID: null] Sent (null) Correlation Id is not same as received (null).
[ForkJoinPool.commonPool-worker-3] ERROR com.microsoft.aad.msal4j.PublicClientApplication - [Correlation ID: ] Execution of class com.microsoft.aad.msal4j.AcquireTokenByAuthorizationGrantSupplier failed.
com.microsoft.aad.msal4j.MsalServiceException: WsTrust endpoint not found in metadata document

Error while executing SetApplication command

I'm getting an error while executing script as below:
Set-AzureADApplication : Error occurred while executing SetApplication
Code: Request_BadRequest
Message: Updates to converged applications are not allowed in this version.

  • Set-AzureADApplication -ObjectId $app.ObjectId -RequiredResourceA ...
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [Set-AzureADApplication], ApiException
    • FullyQualifiedErrorId : Microsoft.Open.AzureAD16.Client.ApiException,Microsoft.Open.AzureAD16.PowerShell.SetAppl
      ication

Could you please help me to review this error?
Thank you.

Cannot invoke "String.getBytes(java.nio.charset.Charset)" because "response" is null

Hi, I'm trying the integrated-windows-authentication sample with my [email protected] account. I got the following error: (it is because the WSTrustRequest returned 401)

C:\src\ms-identity-java-desktop\Integrated-Windows-Auth-Flow>java -Dsun.security.jgss.native=true -jar target\public-client-integrated-windows-authentication-sample-1.0.0.jar
==No accounts in cache
[ForkJoinPool.commonPool-worker-3] ERROR com.microsoft.aad.msal4j.PublicClientApplication - [Correlation ID: 52b9b2b4-6f2c-499f-abe4-254410f42a63] Execution of class com.microsoft.aad.msal4j.AcquireTokenSilentSupplier failed.
com.microsoft.aad.msal4j.MsalClientException: Token not found it the cache
        at com.microsoft.aad.msal4j.AcquireTokenSilentSupplier.execute(AcquireTokenSilentSupplier.java:58)
        at com.microsoft.aad.msal4j.AuthenticationResultSupplier.get(AuthenticationResultSupplier.java:59)
        at com.microsoft.aad.msal4j.AuthenticationResultSupplier.get(AuthenticationResultSupplier.java:17)
        at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1764)
        at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1756)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1016)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1665)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1598)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
==acquireTokenSilently call failed: com.microsoft.aad.msal4j.MsalClientException: Token not found it the cache
[ForkJoinPool.commonPool-worker-3] INFO com.microsoft.aad.msal4j.HttpHelper - [Correlation ID: null] Sent (null) Correlation Id is not same as received (null).
[ForkJoinPool.commonPool-worker-3] INFO com.microsoft.aad.msal4j.HttpHelper - [Correlation ID: null] Sent (null) Correlation Id is not same as received (null).
[ForkJoinPool.commonPool-worker-3] ERROR com.microsoft.aad.msal4j.PublicClientApplication - [Correlation ID: 5579c2ad-165b-4fb2-8471-bd6506d8bab6] Execution of class com.microsoft.aad.msal4j.AcquireTokenByAuthorizationGrantSupplier failed.
java.lang.NullPointerException: Cannot invoke "String.getBytes(java.nio.charset.Charset)" because "response" is null
        at com.microsoft.aad.msal4j.WSTrustResponse.parse(WSTrustResponse.java:74)
        at com.microsoft.aad.msal4j.WSTrustRequest.execute(WSTrustRequest.java:48)
        at com.microsoft.aad.msal4j.WSTrustRequest.execute(WSTrustRequest.java:89)
        at com.microsoft.aad.msal4j.AcquireTokenByAuthorizationGrantSupplier.getAuthorizationGrantIntegrated(AcquireTokenByAuthorizationGrantSupplier.java:126)
        at com.microsoft.aad.msal4j.AcquireTokenByAuthorizationGrantSupplier.execute(AcquireTokenByAuthorizationGrantSupplier.java:40)
        at com.microsoft.aad.msal4j.AuthenticationResultSupplier.get(AuthenticationResultSupplier.java:59)
        at com.microsoft.aad.msal4j.AuthenticationResultSupplier.get(AuthenticationResultSupplier.java:17)
        at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1764)
        at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1756)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1016)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1665)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1598)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Exception in thread "main" java.util.concurrent.CompletionException: java.lang.NullPointerException: Cannot invoke "String.getBytes(java.nio.charset.Charset)" because "response" is null
        at com.microsoft.aad.msal4j.AuthenticationResultSupplier.get(AuthenticationResultSupplier.java:93)
        at com.microsoft.aad.msal4j.AuthenticationResultSupplier.get(AuthenticationResultSupplier.java:17)
        at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1764)
        at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1756)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1016)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1665)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1598)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Caused by: java.lang.NullPointerException: Cannot invoke "String.getBytes(java.nio.charset.Charset)" because "response" is null
        at com.microsoft.aad.msal4j.WSTrustResponse.parse(WSTrustResponse.java:74)
        at com.microsoft.aad.msal4j.WSTrustRequest.execute(WSTrustRequest.java:48)
        at com.microsoft.aad.msal4j.WSTrustRequest.execute(WSTrustRequest.java:89)
        at com.microsoft.aad.msal4j.AcquireTokenByAuthorizationGrantSupplier.getAuthorizationGrantIntegrated(AcquireTokenByAuthorizationGrantSupplier.java:126)
        at com.microsoft.aad.msal4j.AcquireTokenByAuthorizationGrantSupplier.execute(AcquireTokenByAuthorizationGrantSupplier.java:40)
        at com.microsoft.aad.msal4j.AuthenticationResultSupplier.get(AuthenticationResultSupplier.java:59)
        ... 8 more

What should I do? How can I debug this error?

And should I set AUTHORITY to https://login.microsoftonline.com/organizations/ or https://login.microsoftonline.com/{tenantid}/ ? I only want to support the accounts end with "@microsoft.com" only.

Thank you!

Password required for managed users - Integrated window authentication

I am trying to run a sample code of MSAL Java Integrated window authentication and it throws an below exception,
ERROR com.microsoft.aad.msal4j.PublicClientApplication - [Correlation ID: 0b3328c3-0644-45bd-961c-09a45f9c851a] Execution of class com.microsoft.aad.msal4j.AcquireTokenByAuthorizationGrantSupplier failed.
com.microsoft.aad.msal4j.MsalClientException: Password is required for managed user
at com.microsoft.aad.msal4j.AcquireTokenByAuthorizationGrantSupplier.getAuthorizationGrantIntegrated(AcquireTokenByAuthorizationGrantSupplier.java:157)
at com.microsoft.aad.msal4j.AcquireTokenByAuthorizationGrantSupplier.execute(AcquireTokenByAuthorizationGrantSupplier.java:50)
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.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:157)
Exception in thread "main" java.util.concurrent.CompletionException: com.microsoft.aad.msal4j.MsalClientException: Password is required for managed user
at com.microsoft.aad.msal4j.AuthenticationResultSupplier.get(AuthenticationResultSupplier.java:89)
at com.microsoft.aad.msal4j.AuthenticationResultSupplier.get(AuthenticationResultSupplier.java:17)
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:157)
Caused by: com.microsoft.aad.msal4j.MsalClientException: Password is required for managed user
at com.microsoft.aad.msal4j.AcquireTokenByAuthorizationGrantSupplier.getAuthorizationGrantIntegrated(AcquireTokenByAuthorizationGrantSupplier.java:157)

AUTHORITY=https://login.microsoftonline.com/organizations/
SCOPE=user.read

I see this below comment in the sample code of Integrated window authentication,
"To acquire a IWA. You will need to generate a Kerberos ticket."

My Queries,

  1. How to fix this issue "Password required for managed users"
  2. To generate a Kerberors ticket, i need to have principal username and password. How to create principal username and
    set password?

Please help me to clarify this doubts.

Thanks,
Ram

redirect URI

how to check redirect URI in Username-Password flow?

AADSTS65001: The user or administrator has not consented to use the application with ID

Hello,

I am following this document https://docs.microsoft.com/en-us/samples/azure-samples/ms-identity-java-desktop/call-msgraph-with-username-password/ and seeing the following issue.

[ForkJoinPool.commonPool-worker-9] ERROR com.microsoft.aad.msal4j.PublicClientApplication - [Correlation ID: 6ed3f887-f7a7-4201-ba9c-6587d8510ef8] Execution of class com.microsoft.aad.msal4j.AcquireTokenByAuthorizationGrantSupplier failed.
com.microsoft.aad.msal4j.MsalInteractionRequiredException: AADSTS65001: The user or administrator has not consented to use the application with ID 'ab8dd9d6-d79b-454d-9c40-236a74cfe698' named 'AzureTestApp01'. Send an interactive authorization request for this user and resource.
Trace ID: 0eb3ee9e-b1c1-43e8-90b3-2a1a70b71100
Correlation ID: 6ed3f887-f7a7-4201-ba9c-6587d8510ef8
Timestamp: 2020-06-19 22:32:40Z

I have followed the steps.

  • Registered the app ad Public client
  • updated Manifest to set allowPublicClient property to true
  • set the User.Read permission
  • also given Grant/revoke admin consent

I have referred multiple articles to resolve this; but none worked. Any pointers will be helpful.

Detecting username for integrated auth flow

Is there any way to implement the Integrated Windows Authentication flow without providing a username? The sample seems to imply that MSAL4J requires the application to provide it.
From: https://github.com/Azure-Samples/ms-identity-java-desktop/blob/4a24acc4726153cae06a81793c82ff721bdb8600/Integrated-Windows-Auth-Flow/README.md#step-4--configure-the-sample-to-use-your-azure-ad-tenant

Step 4: Configure the sample to use your Azure AD tenant

  1. Open the src\main\resources\application.properties file
  2. Set the CLIENT_ID property to the client ID value you recorded earlier
  3. Set the USER_NAME property to your Windows signed-in user ID

From a Windows standpoint, having to provide the username doesn't quite seem "integrated", so I hope I'm missing something simple.

Background: We (the mssql-jdbc team) are migrating from ADAL4J to MSAL4J. I think ADAL4J also requires username to be passed in but I was hoping to eliminate the current ugly workaround used for our IWA auth flow by using MSAL4J.

Thanks!

CC: @lilgreenbird

Token not found in the cache

Hello Team,

We are facing issue when executing the "UsernamePasswordFlow.java". We have provided required information Client_Id.Username and password. We are getting error on line number 80 when getting token.

Kindly let us the know the insights of the issue.

Stack Trace:
==acquireTokenSilently call failed: com.microsoft.aad.msal4j.MsalClientException: Token not found in the cache
[ForkJoinPool.commonPool-worker-2] ERROR com.microsoft.aad.msal4j.PublicClientApplication - [Correlation ID: 467137f6-c2b5-465c-b065-5db00ea99b88] Execution of class com.microsoft.aad.msal4j.AcquireTokenByAuthorizationGrantSupplier failed.
com.microsoft.aad.msal4j.MsalServiceException: AADSTS50059: No tenant-identifying information found in either the request or implied by any provided credentials.
Trace ID: 9d3e9b2b-4d45-49c1-b65b-18c7c9177b00
Correlation ID: 467137f6-c2b5-465c-b065-5db00ea99b88
Timestamp: 2020-12-09 20:20:46Z
at com.microsoft.aad.msal4j.MsalServiceExceptionFactory.fromHttpResponse(MsalServiceExceptionFactory.java:43)
at com.microsoft.aad.msal4j.TokenRequestExecutor.createAuthenticationResultFromOauthHttpResponse(TokenRequestExecutor.java:85)
at com.microsoft.aad.msal4j.TokenRequestExecutor.executeTokenRequest(TokenRequestExecutor.java:36)
at com.microsoft.aad.msal4j.AbstractClientApplicationBase.acquireTokenCommon(AbstractClientApplicationBase.java:105)
at com.microsoft.aad.msal4j.AcquireTokenByAuthorizationGrantSupplier.execute(AcquireTokenByAuthorizationGrantSupplier.java:63)
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.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:172)

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.