当前位置:网站首页>DingTalk Enterprise Internal-H5 Micro Application Development
DingTalk Enterprise Internal-H5 Micro Application Development
2022-07-31 06:24:00 【Forevermoremo】
Foreword
The company needs to use DingTalk-related API to complete the company's internal reimbursement platform.
Project construction
- Create H5 Microapp
Log in to DingTalk Open Platform (https://open-dev.dingtalk.com/#/index), enter "Application Development" -> Internal Development of H5 Micro-Apps -> Create Application, and fill in basic information and configuration development information

Note: Application home page link: vscode needs to install the Liver Server plug-in, open the home page in this way, replace the IP address of the obtained address with the local IP address, and get the application home page link.
2. JSAPI authentication API development
(1) Development of JSAPI authentication server API:
① Obtain the call interface certificate AccessToken through appKey and appSecret (https://oapi.dingtalk.com/gettoken? appkey=appKey&appsecret=appSecret)
②Get a temporary ticket Ticket for JSAPI through AccessToken(https://oapi.dingtalk.com/get_jsapi_ticket?access_token=ACCESS_TOKEN)
I will not write the details of the backend. If you are interested, you can take a look at Dingding Server API Development Document
(2) Development of JSAPI authentication front-end API:
The front end obtains the JSAPI authentication configuration information of the server by sending a request.
if (!localStorage.getItem('sessionId')) {console.log("Authentication started");//App homepage linkvar datas = { "url": "http://192.168.0.66:5500/html/index.html" };apiRequest('post', 'ding_talk/config', datas, function (data) {_config = data.row;dd.config({agentId: _config.agentId, // required, micro application IDcorpId: _config.corpId,//required, enterprise IDtimeStamp: _config.timeStamp, // Required, the timestamp for generating the signaturenonceStr: _config.nonceStr, // Required, generate a random string for signaturesignature: _config.signature, // required, signaturetype: 0, //Optional.0 means the jsapi of the micro application, 1 means the jsapi of the service window; if not filled, the default is 0.This parameter is supported since version 0.8.3 of dingtalk.jsjsApiList: []});dd.ready(function () {console.log('Authentication successful');//Log in});dd.error(function (err) {window.localStorage.setItem("sessionId", '');console.log('dd error: ' + JSON.stringify(err));});}, function (res) {dd.error(function (err) {console.log('dd error: ' + JSON.stringify(err));});console.log(res);});}(3) H5 micro-app free login (users automatically log in to the app)
After the backend gets the login authorization code, it obtains the user information through the server API (/user/getuserinfo) and returns it.
dd.runtime.permission.requestAuthCode({corpId: _config.corpId, // enterprise idonSuccess: function (info) {code = info.code; // User identity information can be obtained through the login-free authorization code//Log inapiRequest('post', 'ding_talk/login', { "code": code }, function (data) {window.localStorage.setItem("sessionId", data.row.sessionId);window.localStorage.setItem("userId", data.row.userId);}, function (res) {console.log(res);})},onFail: function (res) {window.localStorage.setItem("sessionId", '');}});For details on the front-end, see Front-end API Development Documentation
边栏推荐
- 数据预处理、特征工程和特征学习-摘抄
- 人脸识别AdaFace学习笔记
- ROS之service传输图片
- CAS: 1403744-37-5 DSPE-PEG-FA Phospholipid-Polyethylene Glycol-Folic Acid for Scientific Research
- cv2.imread()
- VS connects to MYSQL through ODBC (2)
- 二进制转换成十六进制、位运算、结构体
- ERROR Error: No module factory availabl at Object.PROJECT_CONFIG_JSON_NOT_VALID_OR_NOT_EXIST ‘Error
- wangeditor编辑器内容传至后台服务器存储
- Cholesterol-PEG-Azide CLS-PEG-N3 胆固醇-聚乙二醇-叠氮 MW:3400
猜你喜欢

MW:3400 4-Arm PEG-DSPE 四臂-聚乙二醇-磷脂一种饱和的18碳磷脂

Cholesterol-PEG-DBCO Cholesterol-Polyethylene Glycol-Diphenylcyclooctyne Chemical Reagent

Global scope and function scope in js

DSPE-PEG-COOH CAS: 1403744-37-5 Phospholipid-polyethylene glycol-carboxy lipid PEG conjugate

Cholesterol-PEG-Acid CLS-PEG-COOH Cholesterol-Polyethylene Glycol-Carboxyl Modified Peptides

Cholesterol-PEG-Azide CLS-PEG-N3 胆固醇-聚乙二醇-叠氮 MW:3400

QT VS中双击ui文件无法打开的问题

CNN的一点理解

MySQL 入门:Case 语句很好用

Attention based ASR(LAS)
随机推荐
VS通过ODBC连接MYSQL(二)
mPEG-DSPE 178744-28-0 Methoxy-polyethylene glycol-phosphatidylethanolamine linear PEG phospholipids
数据分析之SQL面试真题
变分自编码器VAE实现MNIST数据集生成by Pytorch
cocos2d-x implements cross-platform directory traversal
Sourcery插件(自动提升代码质量)
softmax函数详解
function in js
超参数优化-摘抄
Podspec verification dependency error problem pod lib lint , need to specify the source
关于Iframe
CAS:474922-22-0 Maleimide-PEG-DSPE 磷脂-聚乙二醇-马来酰亚胺简述
【解决问题】RuntimeError: The size of tensor a (80) must match the size of tensor b (56) at non-singleton
Cholesterol-PEG-Amine CLS-PEG-NH2 Cholesterol-Polyethylene Glycol-Amino Research Use
wangeditor编辑器内容传至后台服务器存储
MW:3400 4-Arm PEG-DSPE 四臂-聚乙二醇-磷脂一种饱和的18碳磷脂
科研试剂Cholesterol-PEG-Maleimide,CLS-PEG-MAL,胆固醇-聚乙二醇-马来酰亚胺
Cholesterol-PEG-Amine CLS-PEG-NH2 胆固醇-聚乙二醇-氨基科研用
Chemical Reagent Phospholipid-Polyethylene Glycol-Amino, DSPE-PEG-amine, CAS: 474922-26-4
Shell/Vim related list