Skip to content

Commit

Permalink
#691 - Silent authentication retrieval for GitHub sponsors
Browse files Browse the repository at this point in the history
  • Loading branch information
estruyf committed Oct 23, 2023
1 parent 0ea972e commit 7c2a596
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
9 changes: 7 additions & 2 deletions src/services/Credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
});
Expand Down

0 comments on commit 7c2a596

Please sign in to comment.