Get public distal micro-channel number of the user's unique identifier by js openId

Micro-channel public number of program development at the time, to obtain user information when the need to use the user's openId, openId is a unique identifier micro-channel users, this operation can be back implementations are also possible front-end implementation, before the project there is to get through the background, seems to use some of the tripartite package, and then looked at me for taking the time to develop micro-channel documents, we found openId get through the front end is also very simple, as follows:

 

First, we have enclosed public micro-channel number of development documents  https://developers.weixin.qq.com/doc/oplatform/Mobile_App/WeChat_Login/Development_Guide.html

 

Second, get openId

The first step, first obtain the code, can be roughly understood as different per-click menu bar public micro-channel number, will have a different code, but with a different user code, and corresponds to a unique openId

    By custom path, you can get the code, note that code can only be used once, used on the failure, link to

 

Step Two: code acquisition openId The request address https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code

       Which appid developers and secret accounts or micro-channel platform appid and appsecret, code is the first step to get the code, the last parameter to the default parameters, regardless of

Guess you like

Origin www.cnblogs.com/jin-zhe/p/11950526.html