diff --git a/src/shared/GitHub/GitHubConstants.cs b/src/shared/GitHub/GitHubConstants.cs index 526b76489..cfe9e3748 100644 --- a/src/shared/GitHub/GitHubConstants.cs +++ b/src/shared/GitHub/GitHubConstants.cs @@ -32,6 +32,11 @@ public static class GitHubConstants // TODO: update this with a real version number once the GCM OAuth application has been deployed to GHE public static readonly Version MinimumEnterpriseOAuthVersion = new Version("99.99.99"); + /// + /// The version string returned from the meta API endpoint for GitHub AE instances. + /// + public const string GitHubAeVersionString = "GitHub AE"; + /// /// Supported authentication modes for GitHub.com. /// diff --git a/src/shared/GitHub/GitHubHostProvider.cs b/src/shared/GitHub/GitHubHostProvider.cs index 606ab878a..05768669b 100644 --- a/src/shared/GitHub/GitHubHostProvider.cs +++ b/src/shared/GitHub/GitHubHostProvider.cs @@ -263,8 +263,15 @@ internal async Task GetSupportedAuthenticationModesAsync(Ur { modes |= AuthenticationModes.Basic; } - if (Version.TryParse(metaInfo.InstalledVersion, out var version) && version >= GitHubConstants.MinimumEnterpriseOAuthVersion) + + if (StringComparer.OrdinalIgnoreCase.Equals(metaInfo.InstalledVersion, GitHubConstants.GitHubAeVersionString)) + { + // Assume all GHAE instances have the GCM OAuth application deployed + modes |= AuthenticationModes.OAuth; + } + else if (Version.TryParse(metaInfo.InstalledVersion, out var version) && version >= GitHubConstants.MinimumEnterpriseOAuthVersion) { + // Only GHES versions beyond the minimum version have the GCM OAuth application deployed modes |= AuthenticationModes.OAuth; }