Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to call the API to obtain login credentials in Mini Program development in exchange for user login status information

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly shows you how to call the API to obtain login credentials in Mini Program development in exchange for user login status information, the content is simple and clear, and I hope it can help you solve your doubts. Next, let me take you to study and learn the article "how to call the interface to obtain login credentials in Mini Program development in exchange for user login status information".

Call the API to obtain login credentials (code) in exchange for user login status information, including the user's unique identity (openid) and the login session key (session_key) and so on. The encryption and decryption communication of user data depends on the session key.

Note: calling login will cause the login state to refresh, and the previous sessionKey may become invalid.

OBJECT parameter description:

The parameter name type is required to indicate whether successFunction API calls successful callback function failFunction No API call failed callback function completeFunction No API call ends callback function (both successful and failed calls will be executed)

Success return parameter description:

The parameter name type indicates the result of the errMsgString call, the codeString user login credential (valid for five minutes). Developers need to call api in the developer server backend and use code in exchange for information such as openid and session_key

Sample code:

/ / app.jsApp ({onLaunch: function () {wx.login ({success: function (res) {if (res.code) {/ / initiate a network request wx.request ({url: 'https://test.com/onLogin',) Data: {code: res.code}})} else {console.log ('failed to get user login status!' + res.errMsg)}) what does Mini Program mean Mini Program is an application that can be used without download or installation. It can be used immediately by scanning a QR code or searching it. It is easy to operate and easy to spread. It can achieve seven major functions, such as message notification, offline code scan, and official account association. It is based on Wechat, similar to APP. You can use it whenever you want. After using it, you will leave without taking up memory.

The above is about "how to call the API to obtain login credentials in Mini Program development in exchange for user login status information". If this article is helpful to you and you 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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report