<PackageReference Include="Azure.Core" Version="1.51.1" />

Azure.Core.AccessToken

public struct AccessToken
Represents an Azure service bearer access token with expiry information.

Gets or sets the binding certificate for the access token. This is used when authenticating via Proof of Possession (PoP).

public DateTimeOffset ExpiresOn { get; }

Gets the time when the provided token expires.

public DateTimeOffset? RefreshOn { get; }

Gets the time when the token should be refreshed.

public string Token { get; }

Get the access token value.

public string TokenType { get; }

Identifies the type of access token.

public AccessToken(string accessToken, DateTimeOffset expiresOn)

Creates a new instance of AccessToken using the provided accessToken and expiresOn.

public AccessToken(string accessToken, DateTimeOffset expiresOn, DateTimeOffset? refreshOn)

Creates a new instance of AccessToken using the provided accessToken and expiresOn.

public AccessToken(string accessToken, DateTimeOffset expiresOn, DateTimeOffset? refreshOn, string tokenType)

Creates a new instance of AccessToken using the provided accessToken and expiresOn.

public AccessToken(string accessToken, DateTimeOffset expiresOn, DateTimeOffset? refreshOn, string tokenType, X509Certificate2 bindingCertificate)

Creates a new instance of AccessToken using the provided accessToken and expiresOn.