# Mini Program login
Mini programs can easily obtain the user identification provided by WeChat through the login ability provided by WeChat official, and quickly establish a user system within the mini program.
# Login Process Timing
# Introductions
- call wx.login() Obtain Temporary login certificate code , and back to the developer server.
- call auth.code2Session Interface, in exchange for Unique user identification OpenID 、 Users under the WeChat open platform accountUnique identifier UnionID(If the current mini program is bound to the WeChat open platform account) and Session key session_key。
Then the developer server can generate a custom login state according to the user identity, which is used to identify the user identity when the front and back end interact in the subsequent business logic.
# Note
- Session key
session_key
Is to do a lot of work with user data Cryptographic signature Of the key. For the application's own data security, the developer serverYou should not distribute the session key to the Mini Program, nor should you make it available to the public。 - Temporary Login Credentials Code Can only be used once