Interface CredentialRefreshListener
- All Known Implementing Classes:
CredentialStoreRefreshListener
,DataStoreCredentialRefreshListener
These methods are called from Credential.refreshToken()
after a response has been
received from refreshing the token. onTokenResponse(com.google.api.client.auth.oauth2.Credential, com.google.api.client.auth.oauth2.TokenResponse)
is called on a successful HTTP
response, and onTokenErrorResponse(com.google.api.client.auth.oauth2.Credential, com.google.api.client.auth.oauth2.TokenErrorResponse)
is called on an error HTTP response.
- Since:
- 1.7
-
Method Summary
Modifier and TypeMethodDescriptionvoid
onTokenErrorResponse
(Credential credential, TokenErrorResponse tokenErrorResponse) Notifies of an error token response fromCredential.refreshToken()
.void
onTokenResponse
(Credential credential, TokenResponse tokenResponse) Notifies of a successful token response fromCredential.refreshToken()
.
-
Method Details
-
onTokenResponse
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
.- Parameters:
credential
- credential on which the token refresh appliedtokenResponse
- token response- Throws:
IOException
-
onTokenErrorResponse
void onTokenErrorResponse(Credential credential, TokenErrorResponse tokenErrorResponse) throws IOException 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.- Parameters:
credential
- credential on which the token refresh appliedtokenErrorResponse
- token error response ornull
for none supplied- Throws:
IOException
-