Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed continuous popup #79

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 0.2.1
- Fixed continuous popup for authentication.

## 0.2.0
- Fixed [#68](https://github.com/ankitbko/vscode-pull-request-azdo/issues/68) - Changed the authentication mechanism from PAT to OAuth using vscode provided authentication session. This will require users to re-authenticate.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"enableProposedApi": false,
"preview": true,
"version": "0.2.0",
"version": "0.2.1",
"publisher": "ankitbko",
"engines": {
"vscode": "^1.79.0"
Expand Down
11 changes: 7 additions & 4 deletions src/azdo/credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ export class CredentialStore implements vscode.Disposable {
}

public async reset() {
this._sessionOptions.forceNewSession = false;
this._sessionOptions.createIfNone = false;
this._sessionOptions.clearSessionPreference = false;
await this.initialize();
}

public async forceAuthentication() {
this._sessionOptions.forceNewSession = true;
this._sessionOptions.createIfNone = false;
this._sessionOptions.clearSessionPreference = true;
Expand All @@ -71,9 +78,6 @@ export class CredentialStore implements vscode.Disposable {

public async logout(): Promise<void> {
this._azdoAPI = undefined;
this._sessionOptions.forceNewSession = true;
this._sessionOptions.createIfNone = false;
this._sessionOptions.clearSessionPreference = true;
}

public async login(): Promise<Azdo | undefined> {
Expand Down Expand Up @@ -158,7 +162,6 @@ export class CredentialStore implements vscode.Disposable {
);
}


private async getToken(session: vscode.AuthenticationSession): Promise<string | undefined> {
return session?.accessToken;
}
Expand Down
2 changes: 1 addition & 1 deletion src/azdo/repositoriesManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export class RepositoriesManager implements vscode.Disposable {

async authenticate(): Promise<boolean> {
// return !!(await this._credentialStore.login());
await this._credentialStore.reset();
await this._credentialStore.forceAuthentication();
if (this._credentialStore.getHub() !== undefined) {
return true;
}
Expand Down
Loading