How small micro-channel program gets openId
1. Small program calls wx.login () to obtain temporary registration certificate code, and the developers back to the server. (Temporary registration certificate code can only be used once)
2. The developer server code that uniquely identifies the user openid exchange and session key session_key.
Small front-end program code
Background code
Micro communication interface:
https://api.weixin.qq.com/sns/jscode2session?appid=APPID&secret=SECRET&js_code=JSCODE&grant_type=authorization_code
Request parameters:
parameter | Mandatory | Explanation |
---|---|---|
appid | Yes | Applet unique identification |
secret | Yes | app secret applet |
js_code | Yes | Log in getting the code |
grant_type | Yes | Fill in the authorization_code |
Return parameter:
parameter | Explanation |
---|---|
openid | Uniquely identifies the user |
session_key | Session key |
Note: appid and can be viewed in a small secret program management background