Migration LDAP to Oauth Keyckoak

Description

We had an instance of rocket.chat with LDAP authentication. We changed to OAUTH Keycloak and for many users it was transparent, but for some we had the following error:
User with username XXXXXX already exists [CustomOAuth]",“stack”:"Error: User with username renata.bauerle already exists [CustomOAuth]\n at AccountsServer. (app/custom-oauth/server/custom_oauth_server.js:359:12)\n at AccountsServer.Accounts.updateOrCreateUserFromExternalService (app/custom-oauth/server/custom_oauth_server.js:434:8)\n at AccountsServer.Accounts.updateOrCreateUserFromExternalService (server/configuration/accounts_meld.js:47:52)\n

Server Setup Information

  • Version of Rocket.Chat Server: 6.0
  • Operating System: ubuntu
  • Deployment Method: docker
  • Number of Running Instances: 1
  • DB Replicaset Oplog: Enabled
  • NodeJS Version: 14.21.2 - x64
  • MongoDB Version: 5.0.8
  • Proxy: haproxy
  • Firewalls involved:

Any additional Information