I use Microsoft.VisualStudio.Services.Client for connecting to TFS/VSTS with different credentials in order to update work items.
In a case when I connect to TFS2017 on premisses and use Personal Access Tokens (PAT), the work item creatin update fails with:
You must pass a valid patch document in the body of the request.
All GET requests work fine though.
The same scenario works if I connect to VSTS (even with PAT) and also when I connect to TFS2017 with NTLM credentials.
Checking it with Fiddler, the problem seems to be, that for this scenario, TFS2017 sends an authentication challenge for every request (for VSTS it only sends it for the first and then just passes in the session id).
The .NET Client sends the proper patch document as the content of the first POST/PATCH request, but it does not include the content again when it responds to the authentication challenge. So the content of the second request is empty and this triggers the "You must pass a valid patch document in the body of the request." at the end.
I have tried it with different authentication ways, but it is all the same, GET requests work (so the auth works in general), but updates not:
new VssBasicCredential(string.Empty, pat)new VssCredentials(new WindowsCredential(new NetworkCredential(string.Empty, pat)))
I think it works for VSTS, because there the authentication challenge only for the first (GET) request, and not for the POST/PATCH requests later.
Any hints about how to get this scenario working?