Browse Source

Changes GitHub scopes to include user access

main
Eric Amodio 2 years ago
parent
commit
54dce9481c
2 changed files with 4 additions and 2 deletions
  1. +1
    -1
      src/git/remotes/github.ts
  2. +3
    -1
      src/premium/github/githubGitProvider.ts

+ 1
- 1
src/git/remotes/github.ts View File

@ -17,7 +17,7 @@ const issueEnricher3rdPartyRegex = /\b(?[^/\s]+\/[^/\s]+)\\#(?[0-9]+)
const fileRegex = /^\/([^/]+)\/([^/]+?)\/blob(.+)$/i; const fileRegex = /^\/([^/]+)\/([^/]+?)\/blob(.+)$/i;
const rangeRegex = /^L(\d+)(?:-L(\d+))?$/; 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 { export class GitHubRemote extends RichRemoteProvider {
protected get authProvider() { protected get authProvider() {

+ 3
- 1
src/premium/github/githubGitProvider.ts View File

@ -87,6 +87,8 @@ import { getRemoteHubApi, GitHubAuthorityMetadata, Metadata, RemoteHubApi } from
const emptyPagedResult: PagedResult<any> = Object.freeze({ values: [] }); const emptyPagedResult: PagedResult<any> = Object.freeze({ values: [] });
const emptyPromise: Promise<GitBlame | GitDiff | GitLog | undefined> = Promise.resolve(undefined); const emptyPromise: Promise<GitBlame | GitDiff | GitLog | undefined> = 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 `(?<!\.lock)` to ensure the branch name doesn't end with `.lock` // Since negative lookbehind isn't supported in all browsers, this leaves out the negative lookbehind condition `(?<!\.lock)` to ensure the branch name doesn't end with `.lock`
const validBranchOrTagRegex = /^[^/](?!.*\/\.)(?!.*\.\.)(?!.*\/\/)(?!.*@\{)[^\000-\037\177 ~^:?*[\\]+[^./]$/; const validBranchOrTagRegex = /^[^/](?!.*\/\.)(?!.*\.\.)(?!.*\/\/)(?!.*@\{)[^\000-\037\177 ~^:?*[\\]+[^./]$/;
@ -2093,7 +2095,7 @@ export class GitHubGitProvider implements GitProvider, Disposable {
if (this._sessionPromise == null) { if (this._sessionPromise == null) {
async function getSession(): Promise<AuthenticationSession> { async function getSession(): Promise<AuthenticationSession> {
try { try {
return await authentication.getSession('github', ['repo'], {
return await authentication.getSession('github', githubAuthenticationScopes, {
createIfNone: true, createIfNone: true,
}); });
} catch (ex) { } catch (ex) {

Loading…
Cancel
Save