Class AccessToken

java.lang.Object
com.azure.core.credential.AccessToken

public class AccessToken extends Object

Represents an immutable access token with a token string and an expiration time.

An Access Token is a security token that is issued by an authentication source, such as Azure Active Directory (AAD), and it represents the authorization to access a specific resource or service. It is typically used to authenticate and authorize requests made to Azure services.

Access Tokens are obtained through the authentication process, where the user or application presents valid credentials (such as a client ID, client secret, username/password, or certificate) to the authentication source. The authentication source then verifies the credentials and issues an Access Token, which is a time-limited token that grants access to the requested resource.

Once an Access Token is obtained, it can be included in the Authorization header of HTTP requests to authenticate and authorize requests to Azure services.

See Also:
  • Constructor Details

    • AccessToken

      public AccessToken(String token, OffsetDateTime expiresAt)
      Creates an access token instance.
      Parameters:
      token - the token string.
      expiresAt - the expiration time.
  • Method Details

    • getToken

      public String getToken()
      Gets the token.
      Returns:
      The token.
    • getExpiresAt

      public OffsetDateTime getExpiresAt()
      Gets the time when the token expires, in UTC.
      Returns:
      The time when the token expires, in UTC.
    • isExpired

      public boolean isExpired()
      Whether the token has expired.
      Returns:
      Whether the token has expired.