Return undefined rather than an empty string

Signed-off-by: Iain Billett <iain@roadie.io>
This commit is contained in:
Iain Billett
2022-01-18 18:30:27 +00:00
parent f45e99e5da
commit 0e76e264e9
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -2,5 +2,5 @@
'@backstage/integration': patch
---
Return an empty token rather than fail where the owner is not in the allowed installation owners
Do not return a token rather than fail where the owner is not in the allowed installation owners
for a GitHub app. This allows anonymous access to public files in the organisation.
@@ -92,11 +92,11 @@ class GithubAppManager {
async getInstallationCredentials(
owner: string,
repo?: string,
): Promise<{ accessToken: string }> {
): Promise<{ accessToken: string | undefined }> {
const { installationId, suspended } = await this.getInstallationData(owner);
if (this.allowedInstallationOwners) {
if (!this.allowedInstallationOwners?.includes(owner)) {
return { accessToken: '' }; // An empty token allows anonymous access to public repos
return { accessToken: undefined }; // An empty token allows anonymous access to public repos
}
}
if (suspended) {