Skip to content

Commit 7ab5780

Browse files
authored
Denying auth causes GraphQL error to show in a notification (#4788)
Fixes #4778
1 parent bbabd45 commit 7ab5780

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Diff for: src/github/credentials.ts

+4
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ export class CredentialStore implements vscode.Disposable {
103103
let session: vscode.AuthenticationSession | undefined = undefined;
104104
let isNew: boolean = false;
105105
let usedScopes: string[] | undefined = SCOPES;
106+
const oldScopes = this._scopes;
107+
const oldEnterpriseScopes = this._scopesEnterprise;
106108
try {
107109
// Set scopes before getting the session to prevent new session events from using the old scopes.
108110
if (authProviderId === AuthProvider.github) {
@@ -115,6 +117,8 @@ export class CredentialStore implements vscode.Disposable {
115117
session = result.session;
116118
isNew = result.isNew;
117119
} catch (e) {
120+
this._scopes = oldScopes;
121+
this._scopesEnterprise = oldEnterpriseScopes;
118122
if (getAuthSessionOptions.forceNewSession && (e.message === 'User did not consent to login.')) {
119123
// There are cases where a forced login may not be 100% needed, so just continue as usual if
120124
// the user didn't consent to the login prompt.

Diff for: src/github/folderRepositoryManager.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ export class FolderRepositoryManager implements vscode.Disposable {
894894
const data = await githubRepository.getOrgTeams(refreshKind);
895895
orgTeams.set(githubRepository.remote.owner, data);
896896
} catch (e) {
897-
// ignore errors from getTeams
897+
break;
898898
}
899899
}
900900
const allTeamsForOrg = orgTeams.get(githubRepository.remote.owner) ?? [];

0 commit comments

Comments
 (0)