VisualStudioCodeCredential class
Connects to Azure using the user account signed in through the Azure Resources extension in Visual Studio Code. Once the user has logged in via the extension, this credential can share the same refresh token that is cached by the extension.
Constructors
Visual |
Creates an instance of VisualStudioCodeCredential to use for automatically authenticating via VSCode. Note: |
Methods
get |
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, then authentication using
VisualStudioCodeCredential
will not be available.
new VisualStudioCodeCredential(options?: VisualStudioCodeCredentialOptions)
Parameters
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>