diff --git a/src/features/auth/data/GitHubInstallationAccessTokenDataSource.ts b/src/features/auth/data/GitHubInstallationAccessTokenDataSource.ts index 7a958619..b82c2112 100644 --- a/src/features/auth/data/GitHubInstallationAccessTokenDataSource.ts +++ b/src/features/auth/data/GitHubInstallationAccessTokenDataSource.ts @@ -17,6 +17,9 @@ export default class GitHubInstallationAccessTokenRefresher { } async getAccessToken(repositoryNames: string[]): Promise { + if (repositoryNames.length == 0) { + throw new Error("Must provide at least one repository name when creating a GitHub installation access token.") + } const auth = createAppAuth({ appId: this.config.appId, clientId: this.config.clientId, diff --git a/src/features/auth/domain/repositoryAccess/CachingRepositoryAccessReaderConfig.ts b/src/features/auth/domain/repositoryAccess/CachingRepositoryAccessReader.ts similarity index 100% rename from src/features/auth/domain/repositoryAccess/CachingRepositoryAccessReaderConfig.ts rename to src/features/auth/domain/repositoryAccess/CachingRepositoryAccessReader.ts diff --git a/src/features/auth/domain/repositoryAccess/index.ts b/src/features/auth/domain/repositoryAccess/index.ts index 6ab0a1d6..1224c7b8 100644 --- a/src/features/auth/domain/repositoryAccess/index.ts +++ b/src/features/auth/domain/repositoryAccess/index.ts @@ -1,2 +1,2 @@ -export { default as CachingRepositoryAccessReader } from "./CachingRepositoryAccessReaderConfig" +export { default as CachingRepositoryAccessReader } from "./CachingRepositoryAccessReader" export { default as RepositoryRestrictingAccessTokenDataSource } from "./RepositoryRestrictingAccessTokenDataSource" diff --git a/src/features/auth/view/client/GuestAccessTokenInvalidPage.tsx b/src/features/auth/view/client/GuestAccessTokenInvalidPage.tsx index 4293c9ef..1de0ce12 100644 --- a/src/features/auth/view/client/GuestAccessTokenInvalidPage.tsx +++ b/src/features/auth/view/client/GuestAccessTokenInvalidPage.tsx @@ -10,7 +10,6 @@ export default function GuestAccessTokenInvalidPage({ organizationName: string }) { const {repositories, isLoading, error} = useRepositoryAccess() - const title = "Could not obtain access" if (isLoading) { return ( @@ -20,15 +19,22 @@ export default function GuestAccessTokenInvalidPage({ } if (error) { return ( - + It was not possible to obtain access to the projects on the {organizationName} organization on GitHub. ) } + if (repositories.length == 0) { + return ( + + Your account does not have access to any projects. + + ) + } const repositoryNamesHTML = makeRepositoryNamesHTML(repositories) const html = `It was not possible to obtain access to all the projects: ${repositoryNamesHTML}.` return ( - +
)