Maybe, we need to migrate the API authentication in the following lines.
|
let query = ''; |
|
const headers= (() => { |
|
if (this.githubCredential === undefined) { |
|
return {}; |
|
} else { |
|
const {githubClientId, githubClientSecret} = this.githubCredential; |
|
const h: {[key: string]: string} = { |
|
// Basic Auth |
|
"Authorization": `Basic: ${Buffer.from(`${githubClientId}:${githubClientSecret}`).toString("base64")}`, |
|
}; |
|
query = `?client_id=${githubClientId}&client_secret=${githubClientSecret}`; |
|
return h; |
|
} |
|
})(); |
|
|
|
const githubRes = await fetch(`https://api.github.com/repos/${repoName}${query}`, { |
|
headers, |
|
}); |