I am using keycloak v 21.0.1 with keycloak-js. I have the following code for keycloak login:
keycloak.onAuthSuccess = () => {...}
keycloak.init({
onLoad: 'login-required',
pkceMethod: "S256",
checkLoginIframe: false,
}).then((authenticated: boolean) => {...})
.catch(err){....}
When run on web, when a call to redirectUri is received after a successful login, "then" block is called and also onAuthSuccess is invoked. When run on the capacitor app on Android, the keycloak login is shown and the login succeeds. I can see my session in keycloak admin UI. Also, I receive the redirectUrl and the app, configured to activate on the redirect Url, does become active. But "then" block is not invoked and event does not get invoked.