(How to) map nextcloud oauth users to (existing) rocketchat users?


I have been running Rocketchat and Nextcloud separately for a while and have now started integrating them. Using the integration app, RC now shows up inside NC and using NC’s oauth feature, I am able to allow NC users to login to RC.

But what about NC users that already are RC users. I would like to map such NC users to their existing RC accounts (instead of creating new accounts for them).

Is that possible? If so, how?

If not, is this possible using some other method of authenticating RC users?


Or, maybe a bit more generally:

In Nextcloud I can allow NC users to link to some external accounts so that when they log in the next time, they can login via the linked external accounts as well (using the sociallogin plugin). So this does not work to map an existing NC account to an existing externally created account but rather it adds a second way to login to an existing NC account.

Is something similar possible in RC?



I am not that familiar with this integration, but most probably it probably only creates the user once it go thru the integration path.

For the existing users, I believe it will depend on the integration logic: assume that the same username in both systems are always the same person, or don’t create the user if there is already the same username.

Sorry, my mentioning the integration didn’t help: I think my issue has nothing to do with the integration, as the integration does nothing to authenticate users in one way or the other (as I understand).

So my question really is about the OAUTH authentication feature.

And after posting my above comment, I did find a discussion on GitHub about enabling some kind of user mapping but it seems this just fizzled out and there was no clear outcome. But mapping based on the email address was mentioned as a theoretical possibility.

And I found other issues where people rendered existing accounts unusable by externally authenticating users with matching existing email addresses. I would like to avoid this kind of problem…

In the OAUTH settings there is a switch “merge users” but it seems to be unclear what exactly it does and how it works. Do you happen to know?


Okay, so I managed to OAUTH my users externally and when the email address returned by the IdP matched the email address of an RC user, the account is mapped and the user is logged.

But one question remains: What does “merge users” do?