Server returned HTTP response code: 401
See original GitHub issueI followed the instructions from this site https://github.com/AzureAD/microsoft-authentication-library-for-java/wiki/Integrated-Windows-Authentication Unfortunately I’m getting 401 response code with this exception:
[ForkJoinPool.commonPool-worker-1] ERROR com.microsoft.aad.msal4j.PublicClientApplication - [Correlation ID: xxx] Execution of class com.microsoft.aad.msal4j.AcquireTokenByAuthorizationGrantSupplier failed.
com.microsoft.aad.msal4j.MsalServiceException: Server returned HTTP response code: 401 for URL : https://adfs.{company_name}.com/adfs/services/trust/2005/windowstransport
at com.microsoft.aad.msal4j.HttpHelper.readResponseFromConnection(HttpHelper.java:164)
at com.microsoft.aad.msal4j.HttpHelper.getResponse(HttpHelper.java:91)
at com.microsoft.aad.msal4j.HttpHelper.executeHttpPost(HttpHelper.java:78)
at com.microsoft.aad.msal4j.HttpHelper.executeHttpRequest(HttpHelper.java:47)
at com.microsoft.aad.msal4j.WSTrustRequest.execute(WSTrustRequest.java:52)
at com.microsoft.aad.msal4j.WSTrustRequest.execute(WSTrustRequest.java:101)
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:57)
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)
I’ve checked the user, scope, clientId and authorization and they are correct. When I run C# example with the same user, scope, clientId and authorization everything works fine.
What can be a reason of this problem ?
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Server returned HTTP response code: 401 for URL: https
401 means "Unauthorized", so there must be something with your credentials. I think that java URL does not support the syntax you are ......
Read more >java.io.IOException: Server returned HTTP response code
Calling the AF may result in HTTP 401 during high load; this is caused by too few connections to the ABAP user management...
Read more >How to Quickly Fix the 401 Unauthorized Error (5 Methods)
The 401 (Unauthorized) status code indicates that the request has not been applied because it lacks valid authentication credentials for the ...
Read more >Why am I getting an error "Server returned HTTP response code
The common cause of this problem (when the customer is using SSO) is caused by the fact that the configured OAuth clientId/clientSecret was...
Read more >Solved: Server returned HTTP response code: 401
Solved: Hi Team, I am trying to log a defect into JIRA system using JAVA. But I always get 401 unauthorized error. Even...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
problem was solved. I was missing krb5.ini file in windows dir
I can’t make it work as I’ve checked I’m getting this response:
HTTP/1.1 401 Unauthorized..Content-Length: 0..Server: Microsoft-HTTPAPI/2.0..WWW-Authenticate: Negotiate..Date: