When does WeChat Mini Programs usually need to maintain his login status? My Mini Program is mainly to submit the form, get the user unionid to get through Mini Program and the official account, do I need to maintain my login status?

according to the title, my Mini Program mainly has a form submission to get the user unionid to get through Mini Program and the official account. Do I need to maintain my login status? When it comes to the login state, it makes me feel dizzy.


you can use wx.checkSession () to check whether the login state has expired, and call the wx.login interface again if it expires.


the situation I encountered in maintaining the login status

  1. stay on a page for a long time, or flow in Mini Program
  2. returned from other Mini Program, causing the current Mini Program login status to expire
  3. the user returned Mini Program for the second time because the garbage collection time of IOS and Android is not the same

submit form
users can fill in halfway and switch Mini Program to the background, and come back to fill in after a while, so when submitting the action, it is recommended to check the login status

.
Menu