tfsazure-devops-rest-apiazure-devops-servertfs-2017

Error TF401444 when calling TFS Server REST API with a PAT (personal access token)


I have created a PAT token for my user account in TFS Server 2017 (on-premises, not VSTS). Using Postman I am attempting to call the following REST API with Basic Auth:

GET http://{server:port}/tfs/DefaultCollection/_apis/projects?api-version=1.0

In response I get the following error:

TF401444: Please sign-in at least once as {Well Known SID for my user account} in a web browser to enable access to the service. - Microsoft Team Foundation Server

I have tried opening the same URL in Chrome and attempting to login with the PAT but with no success (the login is not completed). Any suggestions as to what I am missing here?

TFS seems to be recognising the PAT token as I receive a different error if I revoke it.


Solution

  • The issue here was the use of 'DefaultCollection' in the URI. I didn't have permissions on the default project collection in our TFS instance and needed to replace 'DefaultCollection' with the name of the collection I actually did have access to.

    It seems obvious now, but the documentation didn't make it clear that this was a variable part of the URI so I had assumed the API was always hosted as part of the DefaultCollection.