# Weixin Mini Program Login

Weixin Mini Program can easily access the user identity provided by WeChat through the official login ability provided by WeChat, and quickly establish a user system within the Mini Program.

# The log in process sequence

# Introductions

  1. Call [wx.login (]]]((wx.login)) Get the temporary login credential code and pass it back to the developer server.
  2. Call the auth.code2Session interface in exchange for user unique identifier OpenID and the user's open platform account under WeChat unique identifier UnionID (if the current Weixin Mini Program is bound to the WeChat open platform account) and session key session_key .

The developer server can then generate a custom login state based on the user's identity, which can be used to identify the user during subsequent business logic, back-end interactions.

# Note

  1. The session key`session_key]((signature)) is the key to encrypt]((signature)) the user data.To apply its own data security, the developer server should not send the session key to Weixin Mini Program and should not provide the key to the outside world.
  2. Temporary login credential code can only be used once