Unauthorized response from GitHub API on Appveyor

2020-04-16 02:10发布

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?

2条回答
趁早两清
2楼-- · 2020-04-16 02:43

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
查看更多
SAY GOODBYE
3楼-- · 2020-04-16 02:45

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').

查看更多
登录 后发表回答