Is Keycloak supporting Office Js?

Hello

I am developing the outlook add in using Office js in visual studio. I would like to authenticate my plugin by keycloak. I found javascript adapter code for keycloak online and tried to implement that in my plugin. I have follwed below steps.

  1. Download Keycloak zip file and run keycloak server with Https port in local.
  2. In my outlook plugin I have put the javascript adapter code in entry point html.
<script>
    var keycloak = new Keycloak({
        url: 'https://localhost:8443/auth',
        realm: 'example',
        clientId: 'outlookClient'

    });

    keycloak.init({
        promiseType: 'native', onLoad: 'login-required'
    }).then(function (authenticated) {
        console.log(authenticated ? 'authenticated' : 'not authenticated');
    }).catch(function () {
        console.log('failed to initialize')
    });

</script>
  1. I have created Realm and client with same name which I have specified in code.
  2. I have put redirect url of my outlook html page in my keycloak client.
  3. Then tried to run the application I am not able to get the redirect_url from server even in console/Network there is no any error related to keycloak server.

I have implemented above same steps in my angular app which is taking http protocol for request and It is working perfectly. But the outlook add in with office js which is taking https protocol for request it is not working fine.

It will be good if some one can help me to solve out my issue.
Thanks in advance.

Were you eventually able to resolve your issue ?

I am using KC authentication in a Outlook Javascript Add-In with the below call. However, I ran into other security and i-frame issues.

keycloak.init().success(function(authenticated) {;
if (authenticated) {;
// proceedwith logic
} else {;
keycloak.login({idpHint: ‘login’});;
};
if (keycloak.token) {;
// proceeedwith logic
};
})

Any update on this ? I have a similar requirement and facing the same issue. Any pointers will help.