Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace authentication

Namespace for authentication.

Index

Functions

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

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

    • options: AuthenticationGetSessionOptions & { createIfNone: true }

      The {@link GetSessionOptions 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.

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

    Parameters

    • providerId: string

      The id of the provider to use

    • scopes: readonly string[]

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

    • options: AuthenticationGetSessionOptions & { forceNewSession: true | { detail: string } }

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

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

    • Optional options: AuthenticationGetSessionOptions

      The {@link GetSessionOptions getSessionOptions} to use

    Returns Thenable<AuthenticationSession | undefined>

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

  • Register an authentication provider.

    There can only be one provider per id and an error is being thrown when an id has already been used by another provider. Ids are case-sensitive.

    params

    options Additional options for the provider.

    Parameters

    Returns Disposable

    A Disposable that unregisters this provider when being disposed.