Class GoogleTokenResponse (2.5.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
Type Description
GoogleTokenResponse
Overrides
com.google.api.client.auth.oauth2.TokenResponse.clone()

getIdToken()

public final String getIdToken()

Beta
Returns the ID token.

Returns
Type Description
String

parseIdToken()

public GoogleIdToken parseIdToken()

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

Returns
Type Description
GoogleIdToken
Exceptions
Type Description
IOException

set(String fieldName, Object value)

public GoogleTokenResponse set(String fieldName, Object value)
Parameters
Name Description
fieldName String
value Object
Returns
Type Description
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
Name Description
accessToken String
Returns
Type Description
GoogleTokenResponse
Overrides
com.google.api.client.auth.oauth2.TokenResponse.setAccessToken(java.lang.String)

setExpiresInSeconds(Long expiresIn)

public GoogleTokenResponse setExpiresInSeconds(Long expiresIn)
Parameter
Name Description
expiresIn Long
Returns
Type Description
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
Name Description
idToken String
Returns
Type Description
GoogleTokenResponse

setRefreshToken(String refreshToken)

public GoogleTokenResponse setRefreshToken(String refreshToken)
Parameter
Name Description
refreshToken String
Returns
Type Description
GoogleTokenResponse
Overrides
com.google.api.client.auth.oauth2.TokenResponse.setRefreshToken(java.lang.String)

setScope(String scope)

public GoogleTokenResponse setScope(String scope)
Parameter
Name Description
scope String
Returns
Type Description
GoogleTokenResponse
Overrides
com.google.api.client.auth.oauth2.TokenResponse.setScope(java.lang.String)

setTokenType(String tokenType)

public GoogleTokenResponse setTokenType(String tokenType)
Parameter
Name Description
tokenType String
Returns
Type Description
GoogleTokenResponse
Overrides
com.google.api.client.auth.oauth2.TokenResponse.setTokenType(java.lang.String)