Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace authentication

Index

Variables

Const providerIds

providerIds: ReadonlyArray<string>
deprecated

An array of the ids of authentication providers that are currently registered.

Const providers

providers: ReadonlyArray<AuthenticationProviderInformation>

An array of the information of authentication providers that are currently registered.

Functions

getProviderIds

  • getProviderIds(): Thenable<ReadonlyArray<string>>
  • deprecated

    The ids of the currently registered authentication providers.

    Returns Thenable<ReadonlyArray<string>>

    An array of the ids of authentication providers that are currently registered.

getSession

  • Get an authentication session matching the desired scopes. Rejects if a provider with providerId is not registered, or if the user does not consent to sharing authentication information with the extension. If there are multiple sessions with the same scopes, the user will be shown a quickpick to select which account they would like to use.

    Currently, there are only two authentication providers that are contributed from built in extensions to VS Code that implement GitHub and Microsoft authentication: their providerId's are 'github' and 'microsoft'.

    Parameters

    • providerId: string

      The id of the provider to use

    • scopes: string[]

      A list of scopes representing the permissions requested. These are dependent on the authentication provider

    • options: AuthenticationGetSessionOptions & { createIfNone: true }

      The getSessionOptions to use

    Returns Thenable<AuthenticationSession>

    A thenable that resolves to an authentication session

  • Get an authentication session matching the desired scopes. Rejects if a provider with providerId is not registered, or if the user does not consent to sharing authentication information with the extension. If there are multiple sessions with the same scopes, the user will be shown a quickpick to select which account they would like to use.

    Parameters

    • providerId: string

      The id of the provider to use

    • scopes: string[]

      A list of scopes representing the permissions requested. These are dependent on the authentication provider

    • Optional options: AuthenticationGetSessionOptions

      The getSessionOptions to use

    Returns Thenable<AuthenticationSession | undefined>

    A thenable that resolves to an authentication session if available, or undefined if there are no sessions

logout

  • logout(providerId: string, sessionId: string): Thenable<void>
  • deprecated

    Logout of a specific session.

    Parameters

    • providerId: string

      The id of the provider to use

    • sessionId: string

      The session id to remove provider

    Returns Thenable<void>

Const onDidChangeAuthenticationProviders

Const onDidChangeSessions

registerAuthenticationProvider