In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you how Mini Program obtains user information. The content is easy to understand and clear. I hope it can help you solve your doubts. Next, let me take you to study and learn the article "how Mini Program gets user information".
To obtain user information, you need to call the wx.login API first when withCredentials is true.
User authorization scope.userInfo is required
OBJECT parameter description:
The parameter name type is required to indicate whether the minimum version of withCredentialsBoolean contains login status information 1.1.0langString No specify the language in which user information is returned, zh_CN simplified Chinese, zh_TW traditional Chinese, en English. The default is en. 1.3.0successFunction No API calls successful callback function failFunction No API calls failed callback function completeFunction No API calls the finished callback function (both successful and failed calls will be executed)
Note: when withCredentials is true, it is required that wx.login has been called before and the login status has not expired, and the returned data will contain sensitive information such as encryptedData and iv; when withCredentials is false, login status is not required, and the returned data does not contain sensitive information such as encryptedData and iv.
Success return parameter description:
The parameter type describes the userInfoOBJECT user information object, which does not contain sensitive information such as openid. RawDataString does not include the original data string of sensitive information, which is used to calculate the signature. SignatureString uses sha1 (rawData + sessionkey) to get the string, which is used to verify the user information, refer to the documentation signature. For the encrypted data of encryptedDataString complete user information, including sensitive data, see the initial vector of the encrypted data decryption algorithm ivString encryption algorithm for details, and see the encrypted data decryption algorithm for details.
UserInfo parameter description:
The parameter type indicates that the nickNameString user is nicknamed avatarUrlString user avatar, and the last value represents the square avatar size (optional values are 0,46,64,96,132, and 0 represents 640,640 square avatar). This is empty if the user does not have an avatar. If the user changes the avatar, the original avatar URL will be invalid. The gender of the genderString user. A value of 1 is male, and a value of 2 is female. If the value is 0, it is the language of the provinceString user in the city where the cityString user is located, the province where the countryString user is located, and the country where the languageString user is located. Simplified Chinese is zh_CN.
Sample code:
Wx.getUserInfo ({success: function (res) {var userInfo = res.userInfovar nickName = userInfo.nickNamevar avatarUrl = userInfo.avatarUrlvar gender = userInfo.gender / / gender 0: unknown, 1: male, 2: female var province = userInfo.provincevar city = userInfo.cityvar country = userInfo.country}}) what is the advantage of Mini Program compared with developers, Mini Program is less difficult to develop, can save development and operating costs, and allows developers to quickly develop a Mini Program. And Mini Program can be easily obtained and spread in Wechat, which can meet the basic life applications, in line with life services offline stores and non-rigid needs of low-frequency applications. For users, it can save time cost and mobile phone memory space, and have excellent use experience at the same time.
The above is about "how Mini Program gets user information". If this article is helpful to you and think it is well written, please share it with your friends to learn new knowledge. If you want to know more about it, please pay more attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.