Unauthorized response from GitHub API on Appveyor

谁都会走 提交于 2019-12-02 04:31:57

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!