Github user IsurangaPerera commented on a diff in the pull request: https://github.com/apache/syncope/pull/70#discussion_r181099396 --- Diff: core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AccessTokenDataBinderImpl.java --- @@ -135,11 +135,7 @@ accessToken.setAuthorities(authorities); } - accessTokenDAO.save(accessToken); - } - - if (replaceExisting && existing != null) { - accessTokenDAO.delete(existing); + accessTokenDAO.merge(accessToken); --- End diff -- Actually that way there can be 2 tokens at a given moment. Suppose there exist an access token already. when trying to replace it in the old way it creates and saves another token (at this time there is 2 token which is against the unique constraint).
---