From 54dce9481c646a150b072e172e4777b4bb89b45c Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Thu, 3 Feb 2022 03:01:06 -0500 Subject: [PATCH] Changes GitHub scopes to include user access --- src/git/remotes/github.ts | 2 +- src/premium/github/githubGitProvider.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/git/remotes/github.ts b/src/git/remotes/github.ts index c7b3d7f..bfda314 100644 --- a/src/git/remotes/github.ts +++ b/src/git/remotes/github.ts @@ -17,7 +17,7 @@ const issueEnricher3rdPartyRegex = /\b(?[^/\s]+\/[^/\s]+)\\#(?[0-9]+) const fileRegex = /^\/([^/]+)\/([^/]+?)\/blob(.+)$/i; const rangeRegex = /^L(\d+)(?:-L(\d+))?$/; -const authProvider = Object.freeze({ id: 'github', scopes: ['repo'] }); +const authProvider = Object.freeze({ id: 'github', scopes: ['repo', 'read:user', 'user:email'] }); export class GitHubRemote extends RichRemoteProvider { protected get authProvider() { diff --git a/src/premium/github/githubGitProvider.ts b/src/premium/github/githubGitProvider.ts index 46ff14c..856c5fa 100644 --- a/src/premium/github/githubGitProvider.ts +++ b/src/premium/github/githubGitProvider.ts @@ -87,6 +87,8 @@ import { getRemoteHubApi, GitHubAuthorityMetadata, Metadata, RemoteHubApi } from const emptyPagedResult: PagedResult = Object.freeze({ values: [] }); const emptyPromise: Promise = Promise.resolve(undefined); +const githubAuthenticationScopes = ['repo', 'read:user', 'user:email']; + // Since negative lookbehind isn't supported in all browsers, this leaves out the negative lookbehind condition `(? { try { - return await authentication.getSession('github', ['repo'], { + return await authentication.getSession('github', githubAuthenticationScopes, { createIfNone: true, }); } catch (ex) {