diff --git a/CHANGELOG.md b/CHANGELOG.md index 920a9ce8..46e8ba34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ ### 🐞 Fixes - [#685](https://github.com/estruyf/vscode-front-matter/issues/685): Fix when using non-string values in the tag picker +- [#691](https://github.com/estruyf/vscode-front-matter/issues/691): Silent authentication retrieval for GitHub sponsors ## [9.3.0] - 2023-10-06 - [Release notes](https://beta.frontmatter.codes/updates/v9.3.0) diff --git a/src/services/Credentials.ts b/src/services/Credentials.ts index a7ea008d..96a3f3fb 100644 --- a/src/services/Credentials.ts +++ b/src/services/Credentials.ts @@ -21,7 +21,7 @@ export class Credentials { * prompting the user to sign in. * */ const session = await authentication.getSession(GITHUB_AUTH_PROVIDER_ID, SCOPES, { - createIfNone: false + silent: true }); if (session) { @@ -62,8 +62,13 @@ export class Credentials { * Note that this can throw if the user clicks cancel. */ const session = await authentication.getSession(GITHUB_AUTH_PROVIDER_ID, SCOPES, { - createIfNone: true + silent: true }); + + if (!session) { + throw new Error('No GitHub authentication session available.'); + } + this.octokit = new Octokit.Octokit({ auth: session.accessToken });