title: "Requested entity was not found." - Apps Script Execution API error
body: <p>We have an Apps Script that is installed in five G Suite accounts. I am invoking the app scripts from the Java code that is being deployed in Google App Engine. I have stored the five refresh tokens in a properties file and set them in GoogleCredential in a round robin fashion before invoking the Apps Script. When I am trying to invoke the Apps Script <code>Requested entity was not found.</code>, an error is returned. But the same refresh tokens and client secrets work fine when I create a simple java program to invoke the Apps Script. </p>
  
  <pre><code>@Service
  public class GoogleAppsScriptServiceImpl {
      private String[] scriptIds;
  
      private String[] refreshTokens;
  
      private GoogleCerdential credential;
  
      public void executeAppsScript() {
          List&lt;Object&gt; params = new ArrayList&lt;&gt;();
          params.add(googleDocFileId);
  
          ExecutionRequest request = new ExecutionRequest()
                                          .setFunction(APPS_SCRIPT_FUNCTION_NAME)
                                          .setParameters(params);
  
          int index = new Random().nextInt(numOfUsers);
  
          Script scriptService = getScriptService(refreshTokens[index]);
          String scriptId = scriptIds[index];
  
          Operation operation = scriptService.scripts()
                              .run(scriptId, request)
                              .setQuotaUser(UUID.randomUUID().toString())
                              .execute();
      }
  
      private Script getScriptService(String refreshToken) {
          credential.setRefreshToken(refreshToken);
          return new Script.Builder(httpTransport, jsonFactory, credential)
                           .setApplicationName(APPLICATION_NAME)
                           .build();
      }
  
      @PostConstruct
      private void createGoogleCredential() throws Exception {
          jsonFactory = JacksonFactory.getDefaultInstance();
          httpTransport = GoogleNetHttpTransport.newTrustedTransport();
  
          credential = new GoogleCredential.Builder()
                                      .setTransport(httpTransport)
                                      .setJsonFactory(jsonFactory)
                                      .setClientSecrets(clientId, clientSecret)
                                      .build();
  
          refreshTokens = commaDelimitedListToStringArray(refreshTokensProp);
          numOfUsers = refreshTokens.length;
  
          scriptIds = commaDelimitedListToStringArray(scriptsIdsProp);
      }
  
  }
  </code></pre>