Class GoogleTokenResponse (2.0.1)

public class GoogleTokenResponse extends TokenResponse

Google OAuth 2.0 JSON model for a successful access token response as specified in Successful Response, including an ID token as specified in OpenID Connect Session Management 1.0.

This response object is the result of GoogleAuthorizationCodeTokenRequest#execute() and GoogleRefreshTokenRequest#execute(). Use #parseIdToken() to parse the GoogleIdToken and then call GoogleIdTokenVerifier#verify(GoogleIdToken).

Implementation is not thread-safe.

Inheritance

Object > java.util.AbstractMap > com.google.api.client.util.GenericData > com.google.api.client.json.GenericJson > com.google.api.client.auth.oauth2.TokenResponse > GoogleTokenResponse

Constructors

GoogleTokenResponse()

public GoogleTokenResponse()

Methods

clone()

public GoogleTokenResponse clone()
Returns
TypeDescription
GoogleTokenResponse
Overrides
com.google.api.client.auth.oauth2.TokenResponse.clone()

getIdToken()

public final String getIdToken()

Beta
Returns the ID token.

Returns
TypeDescription
String

parseIdToken()

public GoogleIdToken parseIdToken()

Beta
Parses using GoogleIdToken#parse(JsonFactory, String) based on the JSON factory and ID token.

Returns
TypeDescription
GoogleIdToken
Exceptions
TypeDescription
IOException

set(String fieldName, Object value)

public GoogleTokenResponse set(String fieldName, Object value)
Parameters
NameDescription
fieldNameString
valueObject
Returns
TypeDescription
GoogleTokenResponse
Overrides
com.google.api.client.auth.oauth2.TokenResponse.set(java.lang.String,java.lang.Object)

setAccessToken(String accessToken)

public GoogleTokenResponse setAccessToken(String accessToken)
Parameter
NameDescription
accessTokenString
Returns
TypeDescription
GoogleTokenResponse
Overrides
com.google.api.client.auth.oauth2.TokenResponse.setAccessToken(java.lang.String)

setExpiresInSeconds(Long expiresIn)

public GoogleTokenResponse setExpiresInSeconds(Long expiresIn)
Parameter
NameDescription
expiresInLong
Returns
TypeDescription
GoogleTokenResponse
Overrides
com.google.api.client.auth.oauth2.TokenResponse.setExpiresInSeconds(java.lang.Long)

setIdToken(String idToken)

public GoogleTokenResponse setIdToken(String idToken)

Beta
Sets the ID token.

Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.

Parameter
NameDescription
idTokenString
Returns
TypeDescription
GoogleTokenResponse

setRefreshToken(String refreshToken)

public GoogleTokenResponse setRefreshToken(String refreshToken)
Parameter
NameDescription
refreshTokenString
Returns
TypeDescription
GoogleTokenResponse
Overrides
com.google.api.client.auth.oauth2.TokenResponse.setRefreshToken(java.lang.String)

setScope(String scope)

public GoogleTokenResponse setScope(String scope)
Parameter
NameDescription
scopeString
Returns
TypeDescription
GoogleTokenResponse
Overrides
com.google.api.client.auth.oauth2.TokenResponse.setScope(java.lang.String)

setTokenType(String tokenType)

public GoogleTokenResponse setTokenType(String tokenType)
Parameter
NameDescription
tokenTypeString
Returns
TypeDescription
GoogleTokenResponse
Overrides
com.google.api.client.auth.oauth2.TokenResponse.setTokenType(java.lang.String)