microsoft/azure-devops-go-api

Error when try download artifact

gucaldeira opened this issue · 2 comments

Hi folks!

I could not retrieve the zip content file of an pipeline artifact. The method GetArtifactContentZip is returning the error:

TF400813: The user '' is not authorized to access this resource.

Code snippet:
`
connection := azuredevops.NewPatConnection(cfg.Azdevops.OrganizationURL, cfg.Azdevops.AccessToken)
args := build.GetArtifactContentZipArgs{
BuildId: &id,
Project: &cfg.Azdevops.Project,
ArtifactName: &artifactName,
}

artifact, err := buildClient.GetArtifactContentZip(ctx, args)
`

Using the same params I have managed retrieve the artifact information.

+1 on this, I just encountered the same issue

bumping to v7 seemed to change the issue from TF400813: The user 'aaaa....' is not authorized to access this resource. to saying none of the artifacts I listed with GetArtifacts exist when trying to download them with GetArtifactContentZip

work-around for me is to just list the artifacts using GetArtifacts, then manually download the zip content from the DownloadUrl on each of the returned artifact metadata objects, though I'd rather just be able to use GetArtifactContentZip

The GetArtifactContentZip function is still broken. The problem is, that the Authorization header is not sent to the redirected URL.