2

when i call below code, it will go to if statement i.e. keycloak.authenticated. Aftert that keycloak.logout(), neither alert Success nor Fail will not display.

if(keycloak.authenticated) {   
  keycloak.logout().then((success) => {
        alert("Success")
    }).catch((error) => {
           alert("Fail")
    });
}

let me know where i am doing wrong.

Hoks Vishu
  • 63
  • 4
  • You need to pass also logout options, e.g. `{ redirectUri : "" }` – Jan Garaj Feb 16 '22 at 10:22
  • Here is my code. `code` if(keycloak.authenticated) { const url=encodeURIComponent("http://localhost:3000/logout"); const backurl="https://{KEYCLOAK_URL}/auth/realms/{REALM_NAME}//protocol/openid-connect/logout?redirect_uri="+url; keycloak.logout(backurl).then((success) => { alert("Success") }).catch((error) => { alert("Fail") }); `code` Still its not working. I supect that my keycloak url is https but my redirect url is http. This might be the issue. – Hoks Vishu Feb 16 '22 at 13:05

0 Answers0