I try to authenticate using the legacy API, because I need some of the methods from there, which are not available in the new Rest API. While authentication via access token in the rest API works fine, all attempts to authenticate with the legacy API seem to fail. The user behind the access token is not the logged windows user. My code looks like that:
var tokenCredentials = new VssBasicCredential(string.Empty, token);
var connectUrl = settings.ProjectCollectionUrl.ToUrl();
var vssConnection = new VssConnection(connectUrl, tokenCredentials);
// successful
await Task.Run(async () => await vssConnection.ConnectAsync());
// successful
await Task.Run(async () => await vssConnection.ParentConnection.ConnectAsync());
var projectCollection = new TfsTeamProjectCollection(vssConnection.Uri, vssConnection.Credentials);
// fails with with not authorized.
projectCollection.Authenticate();
I tried several other ways, too (e.g. creating win credentials out of network credentials. But all attemps fail with a non authorized exception. Is there any known severe bug in the legacy API?