Gtting 401 error with client generated Kerbeors token added to .net 7 httpclient
- Dominant language
- C#
- Stars
- 567
- Forks
- 109
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
cannot get token to authenticate
**To Reproduce**
.net 7 app Using httpclient with UserDeaultCredentials set to falue
var client = ClientFactory.CreateClient("SuperAssociate");
HttpContent inputContent = new StringContent(GetEvent(), System.Text.Encoding.UTF8, "application/json");
DnsQuery.RegisterImplementation(new PlatformIndependentDnsClient());
var kClient = new KerberosClient();
var kerbCred = new KerberosPasswordCredential("XXXXXX", "YYYYYYY", "salelytics.local");
await kClient.Authenticate(kerbCred);
var ticket = await kClient.GetServiceTicket("host/webtest01.salelytics.local");
var apiHost = "http://webtest01.salelytics.local/";
Guard.Against.NullOrEmpty(apiHost);
client.BaseAddress = new Uri(apiHost);
var apiSite = "SuperAssociateRuss/api/IncomingEvent/";
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Negotiate", Convert.ToBase64String(ticket.EncodeGssApi().ToArray()));
var apiResponse = await client.PostAsync(apiSite, inputContent);
**Expected behavior**
The Authorization Header should validate as my user
The token I get from Kerbeoros.Net is different from the one my chrome browser is sending. should it be the same?
Contributor guide
Assessment
This issue has not been assessed yet.