@@ -3,7 +3,7 @@ import type {
33 AuthenticationProviderAuthenticationSessionsChangeEvent ,
44 AuthenticationSession ,
55} from 'vscode' ;
6- import { authentication , Disposable , EventEmitter , window } from 'vscode' ;
6+ import { Disposable , EventEmitter , window } from 'vscode' ;
77import { uuid } from '@env/crypto' ;
88import type { Container , Environment } from '../../../container' ;
99import { CancellationError } from '../../../errors' ;
@@ -27,7 +27,6 @@ interface StoredSession {
2727
2828export const authenticationProviderId = 'gitlens+' ;
2929export const authenticationProviderScopes = [ 'gitlens' ] ;
30- const authenticationLabel = 'GitKraken: GitLens' ;
3130
3231export interface AuthenticationProviderOptions {
3332 signUp ?: boolean ;
@@ -57,9 +56,6 @@ export class AccountAuthenticationProvider implements AuthenticationProvider, Di
5756
5857 this . _disposable = Disposable . from (
5958 this . _authConnection ,
60- authentication . registerAuthenticationProvider ( authenticationProviderId , authenticationLabel , this , {
61- supportsMultipleAccounts : false ,
62- } ) ,
6359 this . container . storage . onDidChangeSecrets ( ( ) => this . checkForUpdates ( ) ) ,
6460 ) ;
6561 }
@@ -234,6 +230,20 @@ export class AccountAuthenticationProvider implements AuthenticationProvider, Di
234230 }
235231 }
236232
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+
237247 private async createSessionForToken ( token : string , scopes : string [ ] ) : Promise < AuthenticationSession > {
238248 const userInfo = await this . _authConnection . getAccountInfo ( token ) ;
239249 return {
0 commit comments