A glimpse of Ucenter fundamentals

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.