[英]callback failing even though GitHub Installation access Token gets generated
我具有用於生成安裝訪問令牌的以下代碼:
gitInstallationAccessToken.getAccessTokensUrl(jwt, function(appAccessTokensUrl) {
var instance = axios({
method: "POST",
url: appAccessTokensUrl,
headers: {
"Accept" : "application/vnd.github.machine-man-preview+json",
"Authorization" : `Bearer ${jwt}`
}
})
.then(function(response) {
var installationAccessToken = response.data.token;
console.log(`Installation Access Token: ${installationAccessToken}`)
callback(installationAccessToken);
})
.catch(function(error) {
console.warn("Unable to authenticate");
// The request was made and the server responded with a status code
// that falls out of the range of 2xx
if (error.response) {
console.warn(`Status ${error.response.status}`);
console.warn(`${error.response.data.message}`);
}
});
});
它輸出Unable to authenticate
因此在某些時候失敗。 我的問題是console.log('Installation Access Token: ${installationAccessToken}')
輸出令牌,因此我希望回調能夠成功。 是否有任何可能導致失敗的原因?
附加信息
這是在catch中返回的實際錯誤:
ReferenceError: regeneratorRuntime is not defined
at eval (webpack:///./lib/githubService.js?:17:51)
at Object.retrieveIssues (webpack:///./lib/githubService.js?:87:6)
at eval (webpack:///./lib/getPublicGitHubIssues.js?:78:20)
at eval (webpack:///./lib/gitInstallationAccessToken.js?:84:9)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
看起來這可能涉及到的解決方案2 本 。 我不確定最后兩個步驟在哪里。
我安裝了babel-plugin-transform-regenerator
並將import 'babel-polyfill'
到問題文件的頂部。 似乎已經解決了該問題,盡管對我而言這確實沒有意義。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.