6

Hello fellow programmes, I am stuck on the issue with keycloak. I am trying to send from node.js express framework request towards keycloak to logout the user.

Config.keycloakClient = my_realm
Config.keycloakURL = keycloak URL
request.get({
    //url: join(Config.keycloakURL, '/auth/realms/'+ Config.keycloakClient+ '/protocol/openid-connect/logout?' + 'id_token_hint='+req.headers.oidc_access_token), <--- tried this
      url: join(Config.keycloakURL, '/auth/realms/'+ Config.keycloakClient+ '/protocol/openid-connect/logout'), // <-- i also tried this 
      headers:
         { Authorization: "Bearer " + req.headers.oidc_access_token, // <-- also tried Authorization: req.headers.oidc_access_token }

Result - 200 OK, but i can still see active session in active sessions in admin interface

request.post({
    //url: join(Config.keycloakURL, '/auth/realms/'+ Config.keycloakClient+ '/protocol/openid-connect/logout?' + 'id_token_hint='+req.headers.oidc_access_token), <--- tried this
      url: join(Config.keycloakURL, '/auth/realms/'+ Config.keycloakClient+ '/protocol/openid-connect/logout'), // <-- i also tried this 
      headers:
          { Authorization: "Bearer " + req.headers.oidc_access_token, // <-- also tried Authorization: req.headers.oidc_access_token }

Result - 302 redirect, but i can still see active session in active sessions in admin interface

I was trying to find the refresh token, but when accessing

Config.keycloakURL/auth/realms/{realm}

i could not get the refesh token-> it redirects me to the login page.

In session storage / cookies i can not see anything strange via chrome dev tools. So what is the proper way to logout with endpoint? Which endpoint and what parameters should i use please? And how am i to obtain refresh token?

Thanks for the help!

Best regards

Daniel Javorský
  • 93
  • 1
  • 2
  • 7
  • This may be caused by behavior I saw when using frontchannel logout configured with a logout url. See here: https://stackoverflow.com/questions/55130831/how-to-have-keycloak-logout-unset-session/55131719#55131719 – Mark Mar 12 '19 at 22:43

0 Answers0