Class AccessToken (1.36.0)

publicclass AccessTokenimplementsSerializable

Represents a temporary OAuth2 access token and its expiration information.

Inheritance

Object > AccessToken

Implements

Serializable

Static Methods

newBuilder()

publicstaticAccessToken.BuildernewBuilder()
Returns
Type Description
AccessToken.Builder

Constructors

AccessToken(String tokenValue, Date expirationTime)

publicAccessToken(StringtokenValue,DateexpirationTime)
Parameters
Name Description
tokenValue String

String representation of the access token.

expirationTime Date

Time when access token will expire.

Methods

equals(Object obj)

publicbooleanequals(Objectobj)
Parameter
Name Description
obj Object
Returns
Type Description
boolean
Overrides

getExpirationTime()

publicDategetExpirationTime()

Time when access token will expire.

Returns
Type Description
Date

The expiration time as a Date.

getScopes()

publicList<String>getScopes()

Scopes from the access token response. Not all credentials provide scopes in response and as per https://datatracker.ietf.org/doc/html/rfc6749#section-5.1 it is optional in the response.

Returns
Type Description
List<String>

List of scopes

getTokenValue()

publicStringgetTokenValue()

String representation of the access token.

Returns
Type Description
String

The raw access token string value.

hashCode()

publicinthashCode()
Returns
Type Description
int
Overrides

toBuilder()

publicAccessToken.BuildertoBuilder()
Returns
Type Description
AccessToken.Builder

toString()

publicStringtoString()
Returns
Type Description
String
Overrides

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年10月30日 UTC.