在开发企业微信小程序时,有时需要获取当前登录用户的详细信息,如部门、邮箱等,现做以下总结。
Related free learning recommendations: WeChat Mini Program Development
Related configuration items
Open WeChat Developer Tools, switch to mini program mode, and configure mini program related information :
WeChat Developer Tools Switch to Enterprise WeChat Mini Program Mode, click Simulate Operation -》Select enterprise and select the corresponding enterprise information, as shown in the picture:
# #Get the temporary login credentials issued by Enterprise WeChat
##Get access_token
Document address:access_token
Replace the correct ##Get information such as session_key, user userid and corpid of the user's enterpriseDocument address:
https://work.weixin.qq.com/api/doc/90000/90136/91507Interface address:
https://qyapi.weixin .qq.com/cgi-bin/miniprogram/jscode2session?access_token=ACCESS_TOKEN&js_code=CODE&grant_type=authorization_codeReplace the correct parameters: ACCESS_TOKEN, CODE, grant_type (fixed here to
authorization_codeRead member information Document address:
https://work.weixin.qq.com/api/doc/90000/90135/90196Request method: GET (HTTPS)
Replacement parameters: ACCESS_TOKEN, USERID, the request result is as shown below :
The above is the detailed content of Detailed explanation of enterprise WeChat login to obtain user information. For more information, please follow other related articles on the PHP Chinese website!