Akhil Bhatnagar
Akhil Bhatnagar

Reputation: 7

How to pass authentication required check if downloading Zip file form JFROG Artifactory

I am using this command in workflow file

Invoke-WebRequest -Uri ${{ env.Some_URL }} -OutFile file.zip

and in environment variable i am setting this

  ARTIFACTORY_JFROGHUBVWGROUPCOM_USR: ${{ secrets.ARTIFACTORY_USER }}
  ARTIFACTORY_JFROGHUBVWGROUPCOM_PSW: ${{ secrets.ARTIFACTORY_API_KEY }}
  Some_URL: "https://${{ secrets.ARTIFACTORY_USER }}:${{ secrets.ARTIFACTORY_API_KEY }}@jfrog.hub.vwgroup.com/artifactory/some.zip"

Now when i execute the workflow it is saying Authentication is required (PFA) error message in runner

NOTE: I am using windows as runner and if this user doesn't have access then error message will different for sure.

I am expecting that zip file should be downloaded, because it does have username and api with it in JFROG link

Upvotes: 0

Views: 85

Answers (1)

Delta George
Delta George

Reputation: 4216

You are using an API Key. The easiest way is to pass it in a header:

Invoke-WebRequest -Uri ${{ env.Some_URL }} -OutFile file.zip -Headers @{ "APIKey" = "AKC...WP"}

See Help Centre

Upvotes: 0

Related Questions