Interface CredentialRefreshListener (1.34.1)

public interface CredentialRefreshListener

Listener for refresh token results.

These methods are called from Credential#refreshToken() after a response has been received from refreshing the token. #onTokenResponse is called on a successful HTTP response, and #onTokenErrorResponse is called on an error HTTP response.

Methods

onTokenErrorResponse(Credential credential, TokenErrorResponse tokenErrorResponse)

public abstract void onTokenErrorResponse(Credential credential, TokenErrorResponse tokenErrorResponse)

Notifies of an error token response from Credential#refreshToken().

Typical use is to provide functionality like removing persistence of the access token from the data store. Implementations can assume proper thread synchronization is already taken care of inside Credential#refreshToken(). Implementations can also assume that Credential#setAccessToken, and Credential#setExpiresInSeconds have already been called previously with null to clear their values.

Parameters
NameDescription
credentialCredential

credential on which the token refresh applied

tokenErrorResponseTokenErrorResponse

token error response or null for none supplied

Exceptions
TypeDescription
IOException

onTokenResponse(Credential credential, TokenResponse tokenResponse)

public abstract void onTokenResponse(Credential credential, TokenResponse tokenResponse)

Notifies of a successful token response from Credential#refreshToken().

Typical use is to provide functionality like persisting the access token in a data store. Implementations can assume proper thread synchronization is already taken care of inside Credential#refreshToken(). Implementations can also assume that Credential#setAccessToken, Credential#setRefreshToken, and Credential#setExpiresInSeconds have already been called previously with the information from the TokenResponse.

Parameters
NameDescription
credentialCredential

credential on which the token refresh applied

tokenResponseTokenResponse

token response

Exceptions
TypeDescription
IOException