Class CredentialStoreRefreshListener
- All Implemented Interfaces:
CredentialRefreshListener
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(com.google.api.client.auth.oauth2.CredentialRefreshListener)
.
- Since:
- 1.7
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CredentialStore
Deprecated.Credential store.private final String
Deprecated.User ID whose credential is to be updated. -
Constructor Summary
ConstructorsConstructorDescriptionCredentialStoreRefreshListener
(String userId, CredentialStore credentialStore) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.Returns the credential store.void
makePersistent
(Credential credential) Deprecated.Stores the updated credential in the credential store.void
onTokenErrorResponse
(Credential credential, TokenErrorResponse tokenErrorResponse) Deprecated.Notifies of an error token response fromCredential.refreshToken()
.void
onTokenResponse
(Credential credential, TokenResponse tokenResponse) Deprecated.Notifies of a successful token response fromCredential.refreshToken()
.
-
Field Details
-
credentialStore
Deprecated.Credential store. -
userId
Deprecated.User ID whose credential is to be updated.
-
-
Constructor Details
-
CredentialStoreRefreshListener
Deprecated.- Parameters:
userId
- user ID whose credential is to be updatedcredentialStore
- credential store
-
-
Method Details
-
onTokenResponse
Deprecated.Description copied from interface:CredentialRefreshListener
Notifies of a successful token response fromCredential.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 thatCredential.setAccessToken(java.lang.String)
,Credential.setRefreshToken(java.lang.String)
, andCredential.setExpiresInSeconds(java.lang.Long)
have already been called previously with the information from theTokenResponse
.- Specified by:
onTokenResponse
in interfaceCredentialRefreshListener
- Parameters:
credential
- credential on which the token refresh appliedtokenResponse
- token response- Throws:
IOException
-
onTokenErrorResponse
public void onTokenErrorResponse(Credential credential, TokenErrorResponse tokenErrorResponse) throws IOException Deprecated.Description copied from interface:CredentialRefreshListener
Notifies of an error token response fromCredential.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 thatCredential.setAccessToken(java.lang.String)
, andCredential.setExpiresInSeconds(java.lang.Long)
have already been called previously withnull
to clear their values.- Specified by:
onTokenErrorResponse
in interfaceCredentialRefreshListener
- Parameters:
credential
- credential on which the token refresh appliedtokenErrorResponse
- token error response ornull
for none supplied- Throws:
IOException
-
getCredentialStore
Deprecated.Returns the credential store. -
makePersistent
Deprecated.Stores the updated credential in the credential store.- Throws:
IOException
-
DataStoreCredentialRefreshListener
instead.