Class CredentialStoreRefreshListener (1.32.1)

public final class CredentialStoreRefreshListener implements CredentialRefreshListener

(deprecated) (to be removed in the future) Use DataStoreCredentialRefreshListener instead.

Beta
Thread-safe OAuth 2.0 credential refresh listener that stores the refresh token response in the credential store.

It needs to be added as a refresh listener using Credential.Builder#addRefreshListener.

Inheritance

java.lang.Object > CredentialStoreRefreshListener

Constructors

CredentialStoreRefreshListener(String userId, CredentialStore credentialStore) (deprecated)

public CredentialStoreRefreshListener(String userId, CredentialStore credentialStore)
Parameters
NameDescription
userIdString

user ID whose credential is to be updated

credentialStoreCredentialStore

credential store

Methods

getCredentialStore() (deprecated)

public CredentialStore getCredentialStore()

Returns the credential store.

Returns
TypeDescription
CredentialStore

makePersistent(Credential credential) (deprecated)

public void makePersistent(Credential credential)

Stores the updated credential in the credential store.

Parameter
NameDescription
credentialCredential
Exceptions
TypeDescription
IOException

onTokenErrorResponse(Credential credential, TokenErrorResponse tokenErrorResponse) (deprecated)

public 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
tokenErrorResponseTokenErrorResponse
Exceptions
TypeDescription
IOException

onTokenResponse(Credential credential, TokenResponse tokenResponse) (deprecated)

public 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
tokenResponseTokenResponse
Exceptions
TypeDescription
IOException