Skip to content
Advertisement

While trying to retrieve the AccesToken using HttpClient I am getting an error

While trying to retrieve the Acces Token from a windows server using HttpClient I am getting an error:

“GSSAPI operation failed with error – An invalid status code was supplied (SPNEGO cannot find mechanisms to negotiate).”

JavaScript

system.ComponentModel.win32Exception is throwing as GSSAPI operation failed with error – An invalid status code was supplied (SPNEGO cannot find mechanisms to negotiate)

The above code is working fine in windows but not in Linux (I am using Linux Mint). As of my knowledge, it refers to a problem trying to use Kerberos but no Kerberos ticket is active to authenticate for Linux.

Advertisement

Answer

Finally, I found a solution to this question.

Solution 1:

Step 1. According to this, you should add

JavaScript

Step 2. Since UseDefaultCredentials = true won’t work here, you need to pass your Network credentials manually to HttpClient like below

JavaScript

Step 3. You should change your HttpRequestMessage version to

HttpVersion.Version11.

Solution 2: You can also fix this issue by converting your entire application into NetcoreApp3.0

Advertisement