Introduction
WeChat applet is an application launched by Tencent in 2017 that can be used in WeChat without downloading and installing. According to a report from iResearch, the number of monthly active devices on WeChat is over 1.2 billion. Compared with traditional apps, the biggest feature of mini programs is convenience. After the products of major merchants enter the bottleneck period of user growth, they provide users with corresponding services through WeChat mini-programs, which has become another major factor in acquiring users and maintaining customers. Ways, so that the performance of each merchant's products to obtain new growth.
Merchants make their own applets into small programs, and user registration and login is a very important way to reach customers, and it is also the basis for subsequent product services. However, in reality, there are many merchants’ small program applications consumer email list in which the product design of registration and login is very unreasonable and unsmooth, thus leaving a poor first impression on users, leading to loss of users and affecting product reputation.
What are the functional design details of WeChat Mini Program login products? How to implement applet login? When do I need to log in and when consumer email list do I not need to log in? How to design the mini program login to bring the best product experience to users? Around these questions, this article will give you a detailed answer today.
2. Main product interfaces involved in applet login
Before designing a WeChat applet login product, a product manager must have a certain understanding of the WeChat applet login process and related product components. Without understanding the principle and component parameters of Mini Programs, it is difficult to fundamentally design a beautiful login product. The product manager needs to know the login of the WeChat applet, and also know the reason. This chapter will introduce the relevant product interfaces involved in WeChat applet login.
2.1 WeChat login [wx.login]
The WeChat login interface [wx.login] is used to obtain login credentials. The applet calls the WeChat login interface. If the call is successful, WeChat will return the user login credentials to the product server. This credential is only valid for 5 minutes. The product server needs to obtain the login credentials returned by WeChat and call [auth.code2Session] to obtain the user. OpenID and session key session_key.
2.2 WeChat login credential verification [auth.code2Session]
The function of WeChat login credential verification [auth.code2Session] is to use WeChat login [wx.login] to obtain login credentials in exchange for the user's openid and session key. openid is the user's unique identifier, which is used to mark the user's identity in the product and associate it with the user's registration information. After the association, the next time the user logs in through the applet, the user can directly use the login authentication function of WeChat, which is convenient for the user to log in.
Here is a detail. Calling the login credential verification [auth.code2Session] will return three values of openid, session_key and unionid. Special attention is that unionid can be used to distinguish the uniqueness of users. This uniqueness is unique in the entire WeChat system, including websites, official accounts, and apps. For the same user, unionid is unique. If your product involves the login of multiple Tencent applications, in order to facilitate the association of users, the user unionid can be used for unified user identification.
2.3 Get user information interface [wx.getUserProfile]
The interface for obtaining user information belongs to the authorization-related functions. The authorization-related interface is familiar to everyone. It is very common in the current WeChat applet application. When a user enters the applet of a product, he will be asked to obtain user-related information, and the user will decide whether to agree or reject it. There are many interfaces related to authorization, such as user information, geographic location, background positioning, WeChat movement, recording, camera, etc. Related to the product login scenario, we mainly use the authorization of user information.
Different from the earliest interface used to obtain user information, the latest user information uses [wx.getUserInfo]. In the latest version, it is best to use [wx.getUserProfile] for WeChat applet to obtain user information. After obtaining the authorization of the user information, the product can generate the user information of the user into the user data of the user system of its own product. It should be noted that after this interface is called, a pop-up window for user authorization will be launched. In order not to disturb customers, this interface should be used with caution. After the user authorizes for the first time, the image address of the user's avatar can be stored, and later Use, you don't need to pop up frequently. There is a small detail. When the user avatar changes, the link to the original avatar cannot be used. At this time, you need to call again to obtain the latest user information.