VisualStudioCodeCredential class

Connects to Azure using the credential provided by the VSCode extension 'Azure Account'. Once the user has logged in via the extension, this credential can share the same refresh token that is cached by the extension.

It's a known issue that this credential doesn't work with Azure Account extension versions newer than 0.9.11. A long-term fix to this problem is in progress. In the meantime, consider authenticating with AzureCliCredential.

Constructors

VisualStudioCodeCredential(VisualStudioCodeCredentialOptions)

Creates an instance of VisualStudioCodeCredential to use for automatically authenticating via VSCode.

Note: VisualStudioCodeCredential is provided by a plugin package: @azure/identity-vscode. If this package is not installed and registered using the plugin API (useIdentityPlugin), then authentication using VisualStudioCodeCredential will not be available.

Methods

getToken(string | string[], GetTokenOptions)

Returns the token found by searching VSCode's authentication cache or returns null if no token could be found.

Constructor Details

VisualStudioCodeCredential(VisualStudioCodeCredentialOptions)

Creates an instance of VisualStudioCodeCredential to use for automatically authenticating via VSCode.

Note: VisualStudioCodeCredential is provided by a plugin package: @azure/identity-vscode. If this package is not installed and registered using the plugin API (useIdentityPlugin), then authentication using VisualStudioCodeCredential will not be available.

new VisualStudioCodeCredential(options?: VisualStudioCodeCredentialOptions)

Parameters

options
VisualStudioCodeCredentialOptions

Options for configuring the client which makes the authentication request.

Method Details

getToken(string | string[], GetTokenOptions)

Returns the token found by searching VSCode's authentication cache or returns null if no token could be found.

function getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken>

Parameters

scopes

string | string[]

The list of scopes for which the token will have access.

options
GetTokenOptions

The options used to configure any requests this TokenCredential implementation might make.

Returns

Promise<AccessToken>