keycloak-ionic
keycloak-ionic copied to clipboard
Deviceready has not fired
Hi All,
Short Problem Description: When the user is logged in automatically at startup, the console fires an error:
deviceready has not fired after 5 seconds. Channel not fired: onDOMContentLoaded
If i disable the automatic login and let the user login manually, the error is gone. But Live Reloading of Capacitor does not fire anymore - so it seems like a related bug.
Configuration as below:
app.component.ts
initializeApp() {
this.keycloakservice.init();
App.addListener('appUrlOpen', (data: any) => {
this.zone.run(() => {
let slug = data.url.split("REMOVED_PRIVACY").pop();
if (slug) {
this.router.navigateByUrl(slug);
} else {
this.router.navigate(["/start"])
}
});
});
}
keycloak.service.ts
init() {
this.keycloak = Keycloak({
url: 'REMOVED_PRIVACY',
realm: 'REMOVED_PRIVACY',
clientId: 'REMOVED_PRIVACY'
});
if (Capacitor.isNativePlatform()) {
this.keycloak.init({
adapter: 'capacitor-native',
responseMode: 'query',
redirectUri: 'REMOVED_PRIVACY://REMOVED_PRIVACY',
onLoad: 'check-sso'
});
} else {
this.keycloak.init({
adapter: 'capacitor-native',
responseMode: 'query',
redirectUri: 'http://localhost:8100',
onLoad: 'check-sso',
silentCheckSsoRedirectUri: window.location.origin + '/assets/silent-check-sso.html',
});
}
}