code: public Credential getCredentialFromFileCredentialStoreForInstalledApp(
        String clientId,
        String clientSecret,
        String filePath,
        List<String> scopes,
        HttpTransport transport)
        throws IOException, GeneralSecurityException {
      logger.atFine().log(
          "getCredentialFromFileCredentialStoreForInstalledApp(%s, %s, %s, %s)",
          clientId, clientSecret, filePath, scopes);
      checkArgument(!isNullOrEmpty(clientId), "clientId must not be null or empty");
      checkArgument(!isNullOrEmpty(clientSecret), "clientSecret must not be null or empty");
      checkArgument(!isNullOrEmpty(filePath), "filePath must not be null or empty");
      checkNotNull(scopes, "scopes must not be null");
  
      // Initialize client secrets.
      GoogleClientSecrets.Details details =
          new GoogleClientSecrets.Details().setClientId(clientId).setClientSecret(clientSecret);
      GoogleClientSecrets clientSecrets = new GoogleClientSecrets().setInstalled(details);
  
      // Set up file credential store.
      FileCredentialStore credentialStore = new FileCredentialStore(new File(filePath), JSON_FACTORY);
  
      // Set up authorization code flow.
      GoogleAuthorizationCodeFlow flow =
          new GoogleAuthorizationCodeFlow.Builder(transport, JSON_FACTORY, clientSecrets, scopes)
              .setCredentialStore(credentialStore)
              .setRequestInitializer(new CredentialHttpRetryInitializer())
              .setTokenServerUrl(new GenericUrl(TOKEN_SERVER_URL))
              .build();
  
      // Authorize access.
      return new AuthorizationCodeInstalledApp(flow, new GooglePromptReceiver()).authorize("user");
    }
docs: Initialized OAuth2 credential for the "installed application" flow; where the credential
  typically represents an actual end user (instead of a service account), and is stored as a
  refresh token in a local FileCredentialStore.
  
  @param clientId OAuth2 client ID identifying the 'installed app'
  @param clientSecret OAuth2 client secret
  @param filePath full path to a ".json" file for storing the credential
  @param scopes list of well-formed scopes desired in the credential
  @param transport The HttpTransport used for authorization
  @return credential with desired scopes, possibly obtained from loading {@code filePath}.
  @throws IOException on IO error