Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ async function deferredActivate(context: vscode.ExtensionContext, apiImpl: GitAp
const credentialStore = new CredentialStore(telemetry);
context.subscriptions.push(credentialStore);
// For older clients that don't have this function. The hasSession won't show the Accounts badge if we don't have a session.
if (!vscode.authentication.hasSession || await credentialStore.hasSession(AuthProvider.github)) {
if (!vscode.authentication.hasSession || await credentialStore.hasSession(AuthProvider.github) || await credentialStore.hasSession(AuthProvider['github-enterprise'])) {
await credentialStore.initialize(AuthProvider.github);
if (hasEnterpriseUri()) {
await credentialStore.initialize(AuthProvider['github-enterprise']);
Expand Down
7 changes: 6 additions & 1 deletion src/github/credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,12 @@ export class CredentialStore implements vscode.Disposable {
}

public async hasSession(authProviderId: AuthProvider): Promise<boolean> {
return await vscode.authentication.hasSession(authProviderId, SCOPES);
try {
return await vscode.authentication.hasSession(authProviderId, SCOPES);
} catch (e) {
// When the provider id is github-enterprise hasSession throws.
return false;
}
}

private async setCurrentUser(github: GitHub): Promise<void> {
Expand Down