Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

WeChat small program user information small program login


May 18, 2021 WeChat Mini Program Development Document


Table of contents


The small program is logged in

The small program can easily obtain the user identification provided by WeChat through the login capability provided by WeChat, and quickly establish the user system within the small program.

Sign-in process timing

WeChat small program user information small program login

Description:

  1. Call wx.login() to get the temporary login credential code and pass it back to the developer server.
  2. Call the auth.code2Session interface in exchange for the user's unique identification of openID and session session_key.

The developer server can then generate a custom login state based on the user's identity, which is used to identify the user when interacting back and forth in subsequent business logic.

Attention:

  1. Session key session_key is the key that encrypts the signature of user data. In order to apply its own data security, the developer server should not issue the session key to a small program, nor should it provide it externally.
  2. Temporary login credential code can only be used once