共用方式為


SharedTokenCacheCredential Class

Definition

Authenticates using tokens in a local cache file. This is a legacy mechanism for authenticating clients using credentials provided to Visual Studio. This mechanism for Visual Studio authentication has been replaced by the VisualStudioCredential.

public class SharedTokenCacheCredential : Azure.Core.TokenCredential
type SharedTokenCacheCredential = class
    inherit TokenCredential
Public Class SharedTokenCacheCredential
Inherits TokenCredential
Inheritance
SharedTokenCacheCredential

Constructors

SharedTokenCacheCredential()

Creates a new SharedTokenCacheCredential which will authenticate users signed in through developer tools supporting Azure single sign on.

SharedTokenCacheCredential(SharedTokenCacheCredentialOptions)

Creates a new SharedTokenCacheCredential which will authenticate users signed in through developer tools supporting Azure single sign on.

Methods

GetToken(TokenRequestContext, CancellationToken)

Silently obtains an AccessToken for a user account if the user has already authenticated to another Microsoft application participating in SSO through a shared MSAL cache. Acquired tokens are cached by the credential instance. Token lifetime and refreshing is handled automatically. Where possible, reuse credential instances to optimize cache effectiveness.

GetTokenAsync(TokenRequestContext, CancellationToken)

Silently obtains an AccessToken for a user account if the user has already authenticated to another Microsoft application participating in SSO through a shared MSAL cache. Acquired tokens are cached by the credential instance. Token lifetime and refreshing is handled automatically. Where possible, reuse credential instances to optimize cache effectiveness.

Applies to