As I understand it means:
A micro-channel in the manner specified by splicing an oauth url addresses (
https://open.weixin.qq.com/connect/oauth2/authorize?appid=CORPID&redirect_uri=REDIRECT_URI&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect
)
redirect_uri: my url address
scope:snsapi_base或snsapi_userinfo
snsapi_base: Silent authorized to collect the basic information of the members;
snsapi_userinfo: Silent authorization, members can get more information, but does not contain the phone, email;
snsapi_privateinfo: manual authorization, members can obtain detailed information, including mobile phones, email
2 oauth url to access the address, micro-channel will do some of the work to verify the like, and ultimately if there is no problem, it will add two parameters at this address behind my url: code and state.
3 and then jump to like my url? Code = xxxxxxxx & state = STATE that our address will come up.
4 After we get the code values, use (https://qyapi.weixin.qq.com/cgi-bin/user/getuserinfo?access_token=ACCESS_TOKEN&code=CODE) can get UserId and user_ticket
After we got 5 user_ticket value, use (https://qyapi.weixin.qq.com/cgi-bin/user/getuserdetail?access_token=ACCESS_TOKEN)+ USER_TICKET
Users can get more information
Specific documentation can be seen in two places
https://work.weixin.qq.com/api/doc#90000/90135/91020
https://qydev.weixin.qq.com/wiki/index.php?title= Home
1 construction authorization page link
The following is a micro-channel official document content:
If companies need to carry user identity information to open inside pages, the first step is to construct the following link to get the code parameters:
https://open.weixin.qq.com/connect/oauth2/authorize?appid=CORPID&redirect_uri=REDIRECT_URI&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect
Parameter Description:
parameter | have to | Explanation |
---|---|---|
appid | Yes | Enterprise CorpID |
redirect_uri | Yes | After authorization redirected callback link address, use urlencode to handle links |
response_type | Yes | Return type, fixed at this time: code |
scope | Yes | Application authorization scope. Self-built fixed applications to fill: snsapi_base |
state | no | Redirecting will bring the state parameter, the enterprise can fill parameter values a-zA-Z0-9 length not exceed 128 bytes |
#wechat_redirect | Yes | This parameter determines whether the terminal identification information need to take |
After the employee clicks, the page will jump to redirect_uri? Code = CODE & state = STATE, enterprises can obtain userid employees in accordance with the code parameter. The maximum code length is 512 bytes.
Example:
Suppose that the current business CorpID: wxdd725338566d6ffe visit the link: http:? //Api.3dept.com/cgi-bin/query action = get based on the URL specification, the above parameters were UrlEncode, get spliced OAuth2 link is: HTTPS: // open.weixin.qq.com/connect/oauth2/authorize?appid=wxdd725338566d6ffe & the redirect_uri = HTTP. 2F%%% 2fapi.3dept.com%. 3A-bin 2fcgi 3faction%%% 2fquery 3dget & response_type = code & scope = snsapi_base & State = # wechat_redirect after the employee clicks, the page will jump to http://api.3dept.com/cgi-bin/query?action=get & code = eh3CZBgG333qs9EdaPbCAP1VaOrjuNkiAZHTWgaWsZQ & State = enterprises can obtain userid employees according to code parameter called
We note that construction OAuth2 link parameters redirect_uri is the result of UrlEncode