问题
We just started with a new project and trying to get CI working via Appveyor.
It is an Aurelia
web application so we need jspm
on the build server.
On my workstation I configured jspm manually as suggested by @guybedford in his answer below and configured my authtoken in appveyor.yml script:
- jspm config registries.github.auth %JSPM_GITHUB_AUTH_TOKEN%
Currently my appveyor.yml looks like this, based on the Auto configuring section from JSPM
version: 1.0.{build}
os: Visual Studio 2015
build:
verbosity: detailed
environment:
JSPM_GITHUB_AUTH_TOKEN:#token from jspm registry export github (locally)#
install:
- ps: Set-Culture nl-NL
- ps: Install-Product node $env:nodejs_version
- cd src\Web
- npm uninstall jspm -g
- npm install -g jspm
- npm install -g gulp
- npm install
- jspm config registries.github.auth %JSPM_GITHUB_AUTH_TOKEN%
- jspm config registries.github.maxRepoSize 0
- jspm registry export github #output to see what the registry looks like
- jspm install -y
- gulp build
- cd ..\..
nuget:
account_feed: true
before_build:
- dnvm install -r clr -arch x86 1.0.0-rc1-update1
- dnu restore
- nuget restore
The jspm install - y
command fails with the error: Unauthorized response for GitHub API
.
How do I configure Github credentials properly with JSPM on AppVeyor?
回答1:
It is best to take this token from jspm registry export github
after configuring the credentials locally in order to use the exact same algorithm as jspm instead of doing a manual encoding.
If you really want manual encoding, the auth token actually takes the value of new Buffer(encodeURIComponent(username) + ':' + encodeURIComponent(password)).toString('base64')
.
回答2:
After contact with the Appveyor team we figured oud that the node version was the problem. Installing the stable version of Node works like a charm:
ps: Install-Product node stable
来源:https://stackoverflow.com/questions/35083523/unauthorized-response-from-github-api-on-appveyor