In our bower.json we have this dependency:
"ourpackage": "git+https://xxx.visualstudio.com/DefaultCollection/_git/ourpackage#1.2.3"
I'm using alternate credentials and this works fine on my machine.
When I run this on Visual Studio Team Services it fails as it doesn't have my credentials. I don't want to add my personal alternate credentials to the bower.json file. Another solution would be to just add the files to our project without using bower.
Is there another solution to this?
I ran across this same issue and fixed it like this:
- Make sure to select Options > Allow Scripts to Access OAuth Token in the build definition.
Add a powershell script task to your build definition task, before your bower install command task
$file = "path\to\bower.json"
(Get-Content $file| ForEach-Object { $_ -replace "https://your.visualstudio.com", "https://un:$env:SYSTEM_ACCESSTOKEN@your.visualstudio.com" }) | Set-Content $file
The one caveat I found is that if you have a dependency tree of bower packages hosted on VSTS, you'll have to add all of the dependencies in the tree to your root bower.json file, i.e. package1 includes package2 in its bower.json - you'll need to include both package1 and package2 in your build project's bower.json.
Try using build access oauth token:
Check this link for reference: Use the OAuth token to access the REST API