Skip to main content

Interface: AuthenticationProvider

Defined in: packages/extension-api/src/extension-api.d.ts:4410

A provider for performing authentication to a service.

Properties​

onDidChangeSessions​

readonly onDidChangeSessions: Event<AuthenticationProviderAuthenticationSessionsChangeEvent>

Defined in: packages/extension-api/src/extension-api.d.ts:4415

An event which fires when the array of sessions has changed, or data within a session has changed.

Methods​

createSession()​

createSession(scopes): Promise<AuthenticationSession>

Defined in: packages/extension-api/src/extension-api.d.ts:4438

Prompts a user to login.

If login is successful, the onDidChangeSessions event should be fired.

If login fails, a rejected promise should be returned.

If the provider has specified that it does not support multiple accounts, then this should never be called if there is already an existing session matching these scopes.

Parameters​

scopes​

string[]

A list of scopes, permissions, that the new session should be created with.

Returns​

Promise<AuthenticationSession>

A promise that resolves to an authentication session.


getSessions()​

getSessions(scopes?): Promise<readonly AuthenticationSession[]>

Defined in: packages/extension-api/src/extension-api.d.ts:4423

Get a list of sessions.

Parameters​

scopes?​

string[]

An optional list of scopes. If provided, the sessions returned should match these permissions, otherwise all sessions should be returned.

Returns​

Promise<readonly AuthenticationSession[]>

A promise that resolves to an array of authentication sessions.


removeSession()​

removeSession(sessionId): Promise<void>

Defined in: packages/extension-api/src/extension-api.d.ts:4448

Removes the session corresponding to session id.

If the removal is successful, the onDidChangeSessions event should be fired.

If a session cannot be removed, the provider should reject with an error message.

Parameters​

sessionId​

string

The id of the session to remove.

Returns​

Promise<void>