Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>AppWorks AuthenticationNew to Visual Studio Code? Get it now.
AppWorks Authentication

AppWorks Authentication

AppWorks Team

|
5,777 installs
| (0) | Free
AppWorks Authentication for VSCode
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

AppWorks Authentication for Visual Studio Code

特性

  • BUC login
  • BUC logout

用法

获取用户信息

import * as vscode from 'vscode';

(async function() {
  const userInfo = await vscode.authentication.getSession('AppWorks', [], { createIfNone: true });
  console.log(userInfo);
})()

通过 Command 进行登录

import * as vscode from 'vscode';

vscode.commands.executeCommand('appworks-authentication.login');

通过 Command 退出登录

import * as vscode from 'vscode';

vscode.commands.executeCommand('appworks-authentication.logout');

监听登录、登出的状态

import * as vscode from 'vscode';

function registerSessionChangeEvent() {
  const appworksAuthExt = vscode.extensions.getExtension('iceworks-team.appworks-authentication')!;
  const importedApi = appworksAuthExt.exports;
  importedApi.getOnDidChangeSessionEvent()((event: vscode.AuthenticationProviderAuthenticationSessionsChangeEvent) => {
    console.log('session change', event);
  });
}

获取 SSO_TICKET

SSO_TICKET 是用于免登的临时凭证,有效时间是一分钟,并且使用后就失效了。因此需要每次发起请求前,先获取 SSO_TICKET,然后在请求 query 中带上

import * as vscode from 'vscode';

const appworksAuthExt = vscode.extensions.getExtension('iceworks-team.appworks-authentication')!;
const importedApi = appworksAuthExt.exports;

importedApi.getOneTimeSSOTicket().then((SSO_TICKET: string) => {
  console.log(SSO_TICKET);
}).catch((error: any) => {
  console.error(error);
})
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft