To obtain user information in the exclusive DingTalk, you need to obtain access_token. Let me record the process of obtaining access_token.

1: Download the corresponding version of the SDK: https://openplatform-portal.dg-work.cn/portal/#/helpdoc?docKey=gjyzy&slug=st5ct2

Here I use PHP, so I downloaded the PHP version of the SDK, you can download the corresponding version of the SDK according to your actual situation
image.png
2: Get access_token

//获取access_token
try {
    $executableClient = new ExecutableClient();
    //Saas环境域名为:https://openplatform.dg-work.cn,浙政钉环境域名为:https://openplatform-pro.ding.zj.gov.cn
    $executableClient->setDomain('域名');
    $executableClient->setAccessKey('应用App Key');
    $executableClient->setSecretKey('应用App Secret');
    $executableClient->setApiName('/gettoken.json');
    $result = $executableClient->epaasCurlGet(3);
} catch (\Exception $e) {
    $msg = "getFilterWords|err, code: ". $e->getCode() . "|message: ". $e->getMessage();
    Yii::error($msg);
    return false;
}
$accessToekn = '';
if (isset($result['success']) && $result['success']) {
    $accessToekn = $result['data']['accessToken'];
}

return $accessToekn;

huaweichenai
695 声望115 粉丝

引用和评论

0 条评论