URL url = Resources.getResource(GDrive.class, CLIENTSECRETS_LOCATION);
CharSource charSource = Resources.asCharSource(url, Charsets.UTF_8);
Reader reader = charSource.openStream();
GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(jsonFactory, reader);
GoogleCredential credential = new GoogleCredential.Builder()
.setTransport(httpTransport)
.setJsonFactory(jsonFactory)
.setClientSecrets(clientSecrets)
.build();
credential.setAccessToken(tokens.accessToken);
credential.setRefreshToken(tokens.refreshToken);
Drive drive = new Drive.Builder(httpTransport, jsonFactory, credential)
.setApplicationName("GDrive")
.build();