DataStoreCredentialRefreshListener
instead.@Deprecated @Beta public final class CredentialStoreRefreshListener extends Object implements CredentialRefreshListener
Beta
It needs to be added as a refresh listener using Credential.Builder.addRefreshListener(com.google.api.client.auth.oauth2.CredentialRefreshListener)
.
Constructor and Description |
---|
CredentialStoreRefreshListener(String userId,
CredentialStore credentialStore)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
CredentialStore |
getCredentialStore()
Deprecated.
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 from
Credential.refreshToken() . |
void |
onTokenResponse(Credential credential,
TokenResponse tokenResponse)
Deprecated.
Notifies of a successful token response from
Credential.refreshToken() . |
public CredentialStoreRefreshListener(String userId, CredentialStore credentialStore)
userId
- user ID whose credential is to be updatedcredentialStore
- credential storepublic void onTokenResponse(Credential credential, TokenResponse tokenResponse) throws IOException
CredentialRefreshListener
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(java.lang.String)
, Credential.setRefreshToken(java.lang.String)
, and
Credential.setExpiresInSeconds(java.lang.Long)
have already been called previously with the information
from the TokenResponse
.
onTokenResponse
in interface CredentialRefreshListener
credential
- credential on which the token refresh appliedtokenResponse
- token responseIOException
public void onTokenErrorResponse(Credential credential, TokenErrorResponse tokenErrorResponse) throws IOException
CredentialRefreshListener
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(java.lang.String)
, and Credential.setExpiresInSeconds(java.lang.Long)
have already been
called previously with null
to clear their values.
onTokenErrorResponse
in interface CredentialRefreshListener
credential
- credential on which the token refresh appliedtokenErrorResponse
- token error response or null
for none suppliedIOException
public CredentialStore getCredentialStore()
public void makePersistent(Credential credential) throws IOException
IOException
Copyright © 2011–2021 Google. All rights reserved.