Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace authentication

用于校验身份的命名空间

maintainer

@cxk0831

索引

Functions(3)

getSession

  • 得到一个与所需范围相匹配,且已认证的 session。 如果插件开发者提供的 providerId 没有注册,或者用户不同意与此插件共享身份认证信息,则调用失败。 如果有多个具有相同作用域的 session,则会向用户提供选择入口,让用户选择他们想要使用的账号。

    目前,只有两个已认证身份,它们是由实现 Github 认证插件和 Microsoft 认证插件的开发者贡献的:providerId 是 'github' 和 'microsoft'

    Parameters

    • providerId: string

      要使用的开发者 id

    • scopes: readonly string[]

      代表所请求权限的范围列表。它们由 providerId 决定

    • options: AuthenticationGetSessionOptions & { createIfNone: true }

      需要使用 {@link GetSessionOptions}

    Returns Thenable<AuthenticationSession>

    返回 thenable,解析为已认证身份的 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

    • Optional options: AuthenticationGetSessionOptions

      The {@link GetSessionOptions} to use

    Returns Thenable<AuthenticationSession | undefined>

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

Const onDidChangeSessions

registerAuthenticationProvider

  • 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.

VS Code 插件开发中文文档 | VS Code 中文文档 | VS Code 官网文档 | VS Code 扩展市场

Generated by TypeDoc | 站长统计