question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Server returned HTTP response code: 401

See original GitHub issue

I 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:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mion1985commented, Sep 18, 2019

problem was solved. I was missing krb5.ini file in windows dir

0reactions
mion1985commented, Sep 18, 2019

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:

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found