Interface AuthenticationProvider

A provider for performing authentication to a service.

interface AuthenticationProvider {
    onDidChangeSessions: Event<AuthenticationProviderAuthenticationSessionsChangeEvent>;
    createSession(scopes, options): Thenable<AuthenticationSession>;
    getSessions(scopes, options): Thenable<AuthenticationSession[]>;
    removeSession(sessionId): Thenable<void>;
}

Properties

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

Methods

  • 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: readonly string[]

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

    • options: AuthenticationProviderSessionOptions

      Additional options for creating a session.

    Returns Thenable<AuthenticationSession>

    A promise that resolves to an authentication session.

  • 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 Thenable<void>