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

What is the landing process in WeChat Mini Programs?

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the relevant knowledge of "what is the landing process in WeChat Mini Programs". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "what is the landing process in WeChat Mini Programs" can help you solve the problem.

WeChat Mini Programs landing process

What are 1:session_key and openId? Session_key

The official statement is as follows:

Session_key is a key generated by Wechat server to encrypt and sign user data.

The purpose of session_key

(1) decrypt the "ciphertext in the user information" obtained by the wx.getUserInfo () interface.

(2) it is "treated slightly" and used to maintain the login status of Mini Program.

"slight treatment" is roughly as follows:

(1) generate a random number (officially called 3rd_session)

(2) take this random number as the key,session_key + openid of session as value.

That is, session [3rd _ session] = session_key+openid

OpenIdopenId: user's unique identity

That is: the unique logo of each Wechat user on your Mini Program.

2: how to obtain session_key and openId officially provides HTTP APIs:

Https://api.weixin.qq.com/sns/jscode2session?appid=APPID&secret=SECRET&js_code=JSCODE&grant_type=authorization_code

Get the steps:

(1) obtain appid,secret,js_code

(2) replace the APPID, SECRET and JSCODE of the above interface address with appid,secret,js_code, and assemble the complete address without changing the other addresses.

For example:

3: open this address in the browser or execute this address in the GET of the simulated browser in the background to return the following JSON data (including openid and sessionkey)

WeChat Mini Programs gets session_key and openId (encryption and decryption, signature series)

Summary: from the three steps of 1pm and 2pm, you can get session_key and openId as long as you get appid,secret,js_code.

Acquisition of 4:appid and secret

Appid is Mini Program ID

Secret is the Mini Program key (AppSecret)

How to get it: log in at Mini Program backend

After opening the Mini Program backend URL, registering and logging in, you can find your AppID and AppSecret by pressing the figure below.

WeChat Mini Programs gets session_key and openId (encryption and decryption, signature series)

Note: at present, Mini Program individuals can not register, open the scope of registration: enterprises, government, media, other organizations; of course, in this way, individuals can also register.

How to get login credentials (js_code) by calling wx.login () API for 5:js_code

WeChat Mini Programs gets session_key and openId (encryption and decryption, signature series)

6: summarize the whole process of session_key acquisition

(1) register WeChat Mini Programs and log in to the backend to get appId and secret (key) in the settings.

(2) call wx.login () API to obtain login credential js_code

(3) call wx.request () API to send js_code to the server backend

(4) in the server backend, known appId, secret, js_code

Then call the following officially provided http API to return and obtain openId and session_key

This is the end of the content about "what is the landing process in WeChat Mini Programs". Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

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