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 CredentialStoreDeprecated.Credential store.private final StringDeprecated.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.voidmakePersistent(Credential credential) Deprecated.Stores the updated credential in the credential store.voidonTokenErrorResponse(Credential credential, TokenErrorResponse tokenErrorResponse) Deprecated.Notifies of an error token response fromCredential.refreshToken().voidonTokenResponse(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:CredentialRefreshListenerNotifies 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:
onTokenResponsein 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:CredentialRefreshListenerNotifies 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 withnullto clear their values.- Specified by:
onTokenErrorResponsein interfaceCredentialRefreshListener- Parameters:
credential- credential on which the token refresh appliedtokenErrorResponse- token error response ornullfor none supplied- Throws:
IOException
-
getCredentialStore
Deprecated.Returns the credential store. -
makePersistent
Deprecated.Stores the updated credential in the credential store.- Throws:
IOException
-
DataStoreCredentialRefreshListenerinstead.