Class CredentialStoreRefreshListener (1.34.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
Name Description
userId String

user ID whose credential is to be updated

credentialStore CredentialStore

credential store

Methods

getCredentialStore() (deprecated)

public CredentialStore getCredentialStore()

Returns the credential store.

Returns
Type Description
CredentialStore

makePersistent(Credential credential) (deprecated)

public void makePersistent(Credential credential)

Stores the updated credential in the credential store.

Parameter
Name Description
credential Credential
Exceptions
Type Description
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
Name Description
credential Credential
tokenErrorResponse TokenErrorResponse
Exceptions
Type Description
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
Name Description
credential Credential
tokenResponse TokenResponse
Exceptions
Type Description
IOException