Open yvovonBerg opened 2 months ago
Have you tried setting UseDefaultCredentials
to true
?
Have you tried setting
UseDefaultCredentials
totrue
?
Yes, the same result sadly.
RestSharp doesn't really do anything with those credentials apart from configuring the HTTP message handler with these parameters. I would suggest trying to use WinHttpMessageHandler
as you are running on Windows. You can use RestClientOptions.ConfigureMessageHandler
and configuring it explicitly.
Thanks, I tried with this as well:
Client = new RestClient(new RestClientOptions(Url + Api)
{
UseDefaultCredentials = true,
ConfigureMessageHandler = handler =>
{
if (handler is HttpClientHandler clientHandler)
{
clientHandler.UseDefaultCredentials = true;
}
return handler;
}
});
Same result :(
The code you tried doesn't do more than RestSharp does. I suggested using WinHttpHandler
, but I don't know if it will work. If you can make it work with HttpClient
, it will work with RestClient
.
Describe the bug It appears that CredentialCache.DefaultCredentials is being used by RestSharp but it doesn't properly pass through the credentials for some reason. It should connect through Kerberos.
To Reproduce Does not work on .NET 8 Core:
But does work on .NETFramework v4.8
Expected behavior It should authenticate correctly.
Stack trace 401 response from the webserver.
Desktop (please complete the following information):
Additional context I've also tried to use the useDefaultCredentials flag and the workaround here: https://github.com/dotnet/runtime/issues/84545 of swapping the credentials and useDefaultCredentials arguments but that does not resolve the issue sadly.
Thank you!