Repository navigation
duplicate key value violates unique constraint #39076
Kavalinaveen
started this conversation in
Archive
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi Developers,
I have recently started using browser flow in keycloak using PKCE to authenticate mobile app users. I have written a custom plugin to verify user mobile number and OTP and login users successfully. In one of the scenarios our users may directly uninstall the app and re-login again, or login in two different devices. When user attempts to login and session Id is already present in the DB (using keycloak - v26, offline sessions feature) I am receiving the below error
Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "constraint_offl_us_ses_pk2"
Detail: Key (user_session_id, offline_flag)=(a88c9062-19e1-45ed-9f6f-93c2f98e1da3, 0) already exists.
Which is valid probably but what is the safe work around for this issue,
how can I invalidate the previous session and login the user again. I would appreciate a proper guide on this.
All reactions