[keycloak-user] Keycloak JS + Cordova Adapter + iOS

Jens Schliesser jens.schliesser at gmail.com
Thu Jan 4 10:27:57 EST 2018


Hello,

we have a Angular4 web application running with keycloak.js that works
great.

We are now trying to put this application into a cordova container running
on iOS, but in the login function of the keycloak cordova adapter

var loginUrl = kc.createLoginUrl(options);
var ref = window.open(loginUrl, '_blank', o);

ref is always null, so adding the event listener fails ?!?


We are bootstrapping (main.ts) our angular application like this:

function bootstrapKeyCloak() {
    KeycloakService.init({
        'url': environment.keycloakConfig.url,
        'realm': environment.keycloakConfig.realm,
        'clientId': environment.keycloakConfig.clientId,
    }, {
        onLoad: 'login-required',
        flow: 'standard'
    }).then(() => {
        platformBrowserDynamic().bootstrapModule(AppModule);
    }).catch((e: any) => {
        alert(e);
    });
}

if (typeof window['cordova'] !== 'undefined') {
    if(document) {
        document.addEventListener('deviceready', () => {
            bootstrapKeyCloak();
        }, false);
    }
} else {
    bootstrapKeyCloak();
}


Any ideas why window.open fails and how to fix this?

-- 

Kind Regards,

Jens Schliesser


More information about the keycloak-user mailing list