Class StsTokenExchangeResponse

java.lang.Object
com.google.auth.oauth2.StsTokenExchangeResponse

@NullMarked public final class StsTokenExchangeResponse extends Object
Represents a successful OAuth 2.0 token exchange response from the Google Security Token Service (STS), as defined in RFC 8693, Section 2.2.1.

This class provides access to the exchanged access token, issued token type, token type, expiration time, refresh token (optional), scopes (optional), and the access boundary session key (optional).

Instances are immutable. Use newBuilder(String, String, String) to create an instance.

  • Method Details

    • newBuilder

      public static StsTokenExchangeResponse.Builder newBuilder(String accessToken, String issuedTokenType, String tokenType)
      Returns a new StsTokenExchangeResponse.Builder instance.
      Parameters:
      accessToken - The exchanged access token.
      issuedTokenType - The issued token type. For example, OAuth2Utils.TOKEN_TYPE_ACCESS_TOKEN.
      tokenType - The token type (e.g., "Bearer").
      Returns:
      A new builder for creating StsTokenExchangeResponse instances.
    • getAccessToken

      public AccessToken getAccessToken()
    • getIssuedTokenType

      public String getIssuedTokenType()
    • getTokenType

      public String getTokenType()
    • getExpiresInSeconds

      public @Nullable Long getExpiresInSeconds()
    • getRefreshToken

      public @Nullable String getRefreshToken()
    • getScopes

      public @Nullable List<String> getScopes()
    • getAccessBoundarySessionKey

      public @Nullable String getAccessBoundarySessionKey()
      Returns the access boundary session key if present.
      Returns:
      the access boundary session key or null if not present