Micro-channel applet API ~ login status check

wx.checkSession(Object object)

Check the login state has expired.

Login user interfaces obtained by wx.login state has a certain timeliness. The more user recently used a small program, the more likely a user login state failure. On the other hand if you have been using applets, the user login state remains in effect. DETAILED aging logical channel maintained by the micro, transparent to the developer. Developers only need to call wx.checkSession interface detects the current user login state is valid.

After logging in state expired developer can then call wx.login get a new user login state. Description of the current call is successful session_key not expired, the call fails explanation session_key has expired. More detailed usage  applet login .

parameter

Object object

Attributes Types of Defaults Mandatory Explanation
success function   no Interface call success callback function
fail function   no Interface calls the failure callback function
complete function   no Interface calls the end of the callback function (call succeeds, the failure will be executed)

Sample Code

wx.checkSession ({ 
  Success () { 
    // session_key not expired, and has been effective in this life cycle 
  }, 
  Fail () { 
    // session_key has expired, you need to re-execute the login process 
    wx.login () // log in again 
  } 
} )

 

 

 

 

 

 

.

Guess you like

Origin www.cnblogs.com/jianxian/p/11119559.html