Ucenter is the most commonly used member integration System in China, it defines a set of interfaces for collaboration between different applications (systems).
Registration process
When registering with an app, the app calls Uc_user_register in uc_client/client.php first, allowing Ucenter to add users first. If successful, the user ID is returned, otherwise the error code (less than 0) is returned. The application determines whether to continue registering in the system or prompting for error messages based on the return value.
Ucenter does not define the interface of synchronous registration, the function of synchronous registration is implemented in the interface of synchronous login.
Synchronous Login
When you sign in with an app, you first call Uc_user_login in uc_client/client.php to verify. After the validation passes, the Uc_user_synlogin,ucenter in the file will return the sync login code for each app according to the configuration, and the app that just performed the login action needs to output the code as HTML to the page.
This code, in the form of a script, triggers a request for an interface to a different application, in the approximate form:
<Scripttype= "Text/javascript"src= "Http://aaa.com/api/uc.php?time=xxxxx&code=xxxxx"Reload= "1"></Script><Scripttype= "Text/javascript"src= "Http://bbb.com/api/uc.php?time=xxxxx&code=xxxxx"Reload= "1"></Script>
These codes are output to the page, triggering a request for the api/uc.php of each application separately (the details of the file need to be implemented by each application), and the Uc_note->Synlogin method is called. In this method, it is common to determine if there are users in the application that require a synchronous login, and if not, increase the user.
Note that code is the encrypted string for the actual request parameter, and the Ucenter interface is responsible for marshaling and wrapping.Synchronous logoff
Similar to synchronous login, but basically no need to determine whether the user exists, just destroy the session and other login signs.
A glimpse of Ucenter fundamentals