public class DriveExample public static void main(String[] args) throws Exception // Set up authentication GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder( GoogleNetHttpTransport.newTrustedTransport(), GsonFactory.getDefaultInstance(), "your_client_id", "your_client_secret", Arrays.asList(DriveScopes.DRIVE_FILE)) .setAccessType("offline") .build();