use of org.pentaho.googledrive.vfs.util.CustomLocalServerReceiver in project pentaho-kettle by pentaho.
the class GoogleDriveFileObject method authorize.
private Credential authorize() throws IOException {
InputStream in = new FileInputStream(resolveCredentialsPath() + "/" + resourceBundle.getString("client.secrets"));
GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(in));
GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(HTTP_TRANSPORT, JSON_FACTORY, clientSecrets, SCOPES).setDataStoreFactory(DATA_STORE_FACTORY).setAccessType("offline").build();
Credential credential = new CustomAuthorizationCodeInstalledApp(flow, new CustomLocalServerReceiver()).authorize("user");
return credential;
}
Aggregations