[keycloak-user] check-sso not working as expected with iframe

Michal Hajas mhajas at redhat.com
Mon Aug 26 04:21:09 EDT 2019


Hello Moshin,

this is actually the way check-sso should work. From docs:
check-sso will only authenticate the client if the user is already
logged-in, if the user is not logged-in the browser will be redirected back
to the application and remain unauthenticated.

When you logout in the second tab, the tab with check-sso actually detects
you are logged out, however, it does nothing because it is not supposed to.
You can check it by catching onAuthLogout event. See
https://www.keycloak.org/docs/latest/securing_apps/index.html#callback-events
.

Best regards,
Michal

On Wed, Aug 21, 2019 at 8:34 PM Mohsin Ilyas <mohsin_981 at hotmail.com> wrote:

> Missed the code in original email
>
>
> const keycloak = Keycloak('/keycloak.json');
> keycloak.init({onLoad: ‘check-sso'})
>     .success(authenticated => {
>       if (authenticated) {
>         //do something
>       }
>     })
>     .error(error => {
>       console.log(error)
>     });
>
> ________________________________
> From: Mohsin Ilyas
> Sent: Wednesday, August 21, 2019 11:29 PM
> To: keycloak-user at lists.jboss.org <keycloak-user at lists.jboss.org>
> Subject: check-sso not working as expected with iframe
>
>
> Hi,
>
> Below is my simple logic in my application to re-establish connection with
> keycloak when a page is reloaded. However, the iframe doesn’t seem to work
> well with ‘check-sso’. Because, I have opened the application in one tab
> and in other tab I have opened keycloak but when I logout of keycloak my
> application doesn’t get logout, however, if I use ‘login-required’ the
> application logs out simultaneously with keycloak. Can someone take a look,
> or help me with this? (P.s: I have tried to set checkIframLogin: true in
> the init options but it doesn’t work for me)
>
> Thanks.
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user
>


More information about the keycloak-user mailing list