After some ressearch of the plugin inner workings this code worked by calling the widget from PHP:
the_widget('mooauth_widget');die;
Also this way I can setup a custom login page that will redirect it to the keycloack authentication page:
<div style="display: none;"> <?php
the_widget('mooauth_widget');
?>
</div>
<script>
//attach listener to dom load
document.addEventListener('DOMContentLoaded', function() {
moOAuthLoginNew('keycloak');
});
</script>
<?php die; ?>