Architecture design: how do multiple systems share user information?

how to design if there are multiple systems to share user information?

for example, Alibaba has a series of product systems, such as Alipay, Taobao, Tmall, Aliyun, and so on, but as long as you register any of these products, you can also log in with this account in other products. And your shipping address, personal details and so on will also be retained.

so, how is this system designed?

I can think of two solutions:

Plan 1:

the backend of all products share a database (this is too stupid to be designed this way)

scenario 2:

separate user authentication and user information query into a separate project (including database and code are all independent) for other systems to call.
this does allow users of all systems to share information, so that you can change the shipping address in Alipay. If you open Taobao, you will find that the receiving address in Taobao has also been updated.
but there is a big drawback, that is, it is too troublesome to query across tables. For example, I want to search for order details including user receipt information in a certain period of time, and constantly check across tables.

question

is there a good solution for multiple systems to share user information?

Jul.19,2021

OAuth2 find out. It is no problem that these systems basically provide oauth2 interface


solution 2, but the landlord seems to think that cross-database joint search is too troublesome and wants to use join query? It is not impossible, you can save a copy of user data locally, every time users log in to update user data, the only bad thing is that if users change things on Taobao, they will not know immediately, and only update


landlord's plan 2 is cross-database query, this scheme is not efficient in the case of sub-database and sub-table. This kind of related query can actually be completed at the application level. User system is equivalent to a micro-service. Call its interface to query user information and other operations. Operations such as user authentication can be done through oauth2, or single sign-on systems.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b31454-2bd89.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b31454-2bd89.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?