@@ -3,7 +3,7 @@ import type {
3
3
AuthenticationProviderAuthenticationSessionsChangeEvent ,
4
4
AuthenticationSession ,
5
5
} from 'vscode' ;
6
- import { authentication , Disposable , EventEmitter , window } from 'vscode' ;
6
+ import { Disposable , EventEmitter , window } from 'vscode' ;
7
7
import { uuid } from '@env/crypto' ;
8
8
import type { Container , Environment } from '../../../container' ;
9
9
import { CancellationError } from '../../../errors' ;
@@ -27,7 +27,6 @@ interface StoredSession {
27
27
28
28
export const authenticationProviderId = 'gitlens+' ;
29
29
export const authenticationProviderScopes = [ 'gitlens' ] ;
30
- const authenticationLabel = 'GitKraken: GitLens' ;
31
30
32
31
export interface AuthenticationProviderOptions {
33
32
signUp ?: boolean ;
@@ -57,9 +56,6 @@ export class AccountAuthenticationProvider implements AuthenticationProvider, Di
57
56
58
57
this . _disposable = Disposable . from (
59
58
this . _authConnection ,
60
- authentication . registerAuthenticationProvider ( authenticationProviderId , authenticationLabel , this , {
61
- supportsMultipleAccounts : false ,
62
- } ) ,
63
59
this . container . storage . onDidChangeSecrets ( ( ) => this . checkForUpdates ( ) ) ,
64
60
) ;
65
61
}
@@ -234,6 +230,20 @@ export class AccountAuthenticationProvider implements AuthenticationProvider, Di
234
230
}
235
231
}
236
232
233
+ public async getOrCreateSession (
234
+ scopes : string [ ] ,
235
+ createIfNeeded : boolean ,
236
+ ) : Promise < AuthenticationSession | undefined > {
237
+ const session = ( await this . getSessions ( scopes ) ) [ 0 ] ;
238
+ if ( session != null ) {
239
+ return session ;
240
+ }
241
+ if ( ! createIfNeeded ) {
242
+ return undefined ;
243
+ }
244
+ return this . createSession ( scopes ) ;
245
+ }
246
+
237
247
private async createSessionForToken ( token : string , scopes : string [ ] ) : Promise < AuthenticationSession > {
238
248
const userInfo = await this . _authConnection . getAccountInfo ( token ) ;
239
249
return {
0 commit comments