Skip to content
Back

Connect / link two or more already created user accounts, to one - the preferred way to do this?

  • 0
  • Self Hosted
  • Auth
discorrrdbomba
16 Jan, 2025, 14:22

How can i connect/link two existing user accounts technically, i'm aware of all of the accounts and users mehtods from sdk, but i am interested in how you professionals and appwriters would do this, what would be the common approach? My idea is to create a custom user table called mergedUsers (as we would do it for other custom user information) where i would have the userId of each of them as a primary key, and then an additional attribute like "sameUser" which is of type string[] and where I would store the other userId (or more other userIds if applicable) of the merged user account(s). The same vice versa. So for each userId stored in this attribute there will also be a unique data record with its userId as primary key, and the other userId stored in the sameUser attribute. And then this table would have another third column/attribute, lets say "mergedUserId" in which I would store some UUID or ID.unique(). Each of these data records would be created on each new/first creation of a merged user (aka: adding the first userId to the sameUser attribute of some other user). This could be triggered in each users user settings page. Then one could ask / show this information on a user settings page and could maybe set the "master" information he/she would like to show in the front end components like profile button on the top right, or the value which should be shown as username, etc...

TL;DR
To link multiple user accounts, create a custom user table with primary key as userId and attribute "sameUser" storing related userIds. Maintain a unique mergedUserId for each merged user. Display and manage this information on the user settings page.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more