Link User Identities - Node.js SDK¶
MongoDB Realm provides multiple ways for users to log into your application. Because each method of authentication corresponds to a unique user identity, Realm lets you merge multiple identities corresponding to a single user into one user identity.
For instance, consider an application that enables users to authenticate via anonymous authentication so they may explore functionality without linking to an existing SSO provider or generating a new password. When that user finally decides to create a full account with an SSO provider or email/password authentication, you need some way of persisting the user's original anonymous identity with their new permanent identity.
You can link identities using the linkCredentials() method
User object of a logged-in User.