use of com.google.api.client.auth.oauth2.DataStoreCredentialRefreshListener in project openhab1-addons by openhab.
the class GCalGoogleOAuth method newCredential.
private static Credential newCredential(String userId, DataStore<StoredCredential> credentialDataStore) {
Credential.Builder builder = new Credential.Builder(BearerToken.authorizationHeaderAccessMethod()).setTransport(HTTP_TRANSPORT).setJsonFactory(JSON_FACTORY).setTokenServerEncodedUrl("https://accounts.google.com/o/oauth2/token").setClientAuthentication(new ClientParametersAuthentication(client_id, client_secret)).setRequestInitializer(null).setClock(Clock.SYSTEM);
builder.addRefreshListener(new DataStoreCredentialRefreshListener(userId, credentialDataStore));
return builder.build();
}
Aggregations