Home >WeChat Applet >Mini Program Development >Detailed explanation of enterprise WeChat login to obtain user information

Detailed explanation of enterprise WeChat login to obtain user information

coldplay.xixi
coldplay.xixiforward
2021-03-31 09:44:405968browse

Detailed explanation of enterprise WeChat login to obtain user information

在开发企业微信小程序时,有时需要获取当前登录用户的详细信息,如部门、邮箱等,现做以下总结。

Related free learning recommendations: WeChat Mini Program Development

Related configuration items

  1. Open WeChat Developer Tools, switch to mini program mode, and configure mini program related information :
    Detailed explanation of enterprise WeChat login to obtain user information

  2. 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:
    Detailed explanation of enterprise WeChat login to obtain user information

# #Get the temporary login credentials issued by Enterprise WeChat

    Link address:
  1. https://work.weixin.qq.com/api/doc/90000/90136/91506
  2. Get temporary login credentials
  3. code, as shown below:
    Detailed explanation of enterprise WeChat login to obtain user information

##Get access_token

Document address:
    https://work.weixin.qq.com/api/doc/10013
  1. , jump to the third step to obtain access_token
  2. Request method:
  3. GET (HTTPS)
  4. Request URL:
  5. https://qyapi .weixin.qq.com/cgi-bin/gettoken?corpid=ID&corpsecret=SECRETReplace the correct
  6. appid
  7. and secret, as shown below:

Detailed explanation of enterprise WeChat login to obtain user information

##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/91507
  1. Interface address: https://qyapi.weixin .qq.com/cgi-bin/miniprogram/jscode2session?access_token=ACCESS_TOKEN&js_code=CODE&grant_type=authorization_code
  2. Replace the correct parameters: ACCESS_TOKEN, CODE, grant_type (fixed here to authorization_code
  3. ), the request result is as shown below:

  4. Detailed explanation of enterprise WeChat login to obtain user information

Read member information Document address:

https://work.weixin.qq.com/api/doc/90000/90135/90196
  1. Request method: GET (HTTPS)
  2. Request Address:
  3. https://qyapi.weixin.qq.com/cgi-bin/user/get?access_token=ACCESS_TOKEN&userid=USERID
  4. 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!

Statement:
This article is reproduced at:learnku.com. If there is any infringement, please contact admin@php.cn delete