You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Email OTP Login with Custom SPI Causes Session Loss on Page Refresh (ReactJS + Keycloak)
#43054
I'm implementing email OTP-based login using ReactJS and Keycloak. Here's what I did:
I created a custom SPI to handle sending and validating OTPs.
I duplicated the browser authentication flow, removed all password-related steps, and added my custom SPI step in the flow.
The OTP-based login works correctly, and I get authenticated.
However, I'm facing a session issue: After a successful login via OTP, if I refresh the page, it redirects me back to the login page again - as if the session is lost.
I noticed:
If I set "Require Cookie" in the authentication flow, the session persists after login (refresh works).
But with "Require Cookie" enabled, the initial login doesn't work properly.
I'm stuck between these two issues - either the session gets lost on refresh or login doesn’t work.
Has anyone faced this? Any guidance on how to make OTP login work with proper session persistence?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Hi everyone,
I'm implementing email OTP-based login using ReactJS and Keycloak. Here's what I did:
I created a custom SPI to handle sending and validating OTPs.
I duplicated the browser authentication flow, removed all password-related steps, and added my custom SPI step in the flow.
The OTP-based login works correctly, and I get authenticated.
However, I'm facing a session issue:
After a successful login via OTP, if I refresh the page, it redirects me back to the login page again - as if the session is lost.
I noticed:
If I set "Require Cookie" in the authentication flow, the session persists after login (refresh works).
But with "Require Cookie" enabled, the initial login doesn't work properly.
I'm stuck between these two issues - either the session gets lost on refresh or login doesn’t work.
Has anyone faced this? Any guidance on how to make OTP login work with proper session persistence?
Thanks!
All reactions