Skip to content

Fix Keycloak logout confirmation and stale logged-in avatar after token refresh fails - #436

Open
UdayRajSahai2 wants to merge 1 commit into
devfrom
fix-login-issues
Open

Fix Keycloak logout confirmation and stale logged-in avatar after token refresh fails#436
UdayRajSahai2 wants to merge 1 commit into
devfrom
fix-login-issues

Conversation

@UdayRajSahai2

Copy link
Copy Markdown
Collaborator

Summary

  1. Hitting Log Out with no usable session was sending users to Keycloak /logout without a valid id_token_hint, which showed the “Do you want to log out?” page. Logout now goes to Keycloak only when a session, id_token, and successful refresh exist; otherwise it goes to /login, which already calls signIn('keycloak').So it was suggested don't show logout page instead redirect to login
    Issue : This logout page does not make sense as we are not giving any option other than logging out
image

On Logout:
Still logged in: tell Keycloak to log out in the background, then go to login. Do not show the logout page.
Already expired: skip Keycloak. Go straight to login.
Users should never see the Keycloak logout page.

2.After RefreshAccessTokenError, NextAuth still kept session.user, so the homepage avatar sometimes looked logged in. SessionGuard now signOuts to clear that dead session. Dashboard still redirects to Keycloak login, same as before.

…s logged in user even when it was not logged in
@UdayRajSahai2 UdayRajSahai2 self-assigned this Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant