#691 - Silent authentication retrieval for GitHub sponsors

This commit is contained in:
Elio Struyf
2023-10-23 11:23:15 +02:00
parent 0ea972e4f3
commit 7c2a59615f
2 changed files with 8 additions and 2 deletions
+1
View File
@@ -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)
+7 -2
View File
@@ -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
});