code: public Credential getApplicationDefaultCredentials(List<String> scopes, HttpTransport transport)
        throws IOException, GeneralSecurityException {
      logger.atFine().log("getApplicationDefaultCredential(%s)", scopes);
      return GoogleCredentialWithRetry.fromGoogleCredential(
          GoogleCredential.getApplicationDefault(transport, JSON_FACTORY).createScoped(scopes));
    }
docs: Get Google Application Default Credentials as described in <a
  href="https://developers.google.com/identity/protocols/application-default-credentials#callingjava"
  >Google Application Default Credentials</a>
  
  @param scopes The OAuth scopes that the credential should be valid for.