当前位置:网站首页>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
边栏推荐
- Xiaomi mobile phone SMS location service activation failed
- 自然语言处理相关list
- DSPE-PEG-Biotin, CAS: 385437-57-0, phospholipid-polyethylene glycol-biotin prolongs circulating half-life
- Cholesterol-PEG-Acid CLS-PEG-COOH 胆固醇-聚乙二醇-羧基修饰肽类化合物
- 浏览器中的画中画(Picture-in-Picture)API
- Cholesterol-PEG-NHS NHS-PEG-CLS 胆固醇-聚乙二醇-活性酯可修饰小分子材料
- Pytorch实现ResNet
- Sourcery插件(自动提升代码质量)
- 朴素贝叶斯文本分类(代码实现)
- opencv之图像二值化处理
猜你喜欢

2022 SQL big factory high-frequency practical interview questions (detailed analysis)

如何修改数据库密码

wangeditor富文本编辑器上传图片以及跨域问题解决

Tensorflow steps on the pit while using it

Chemical Reagent Phospholipid-Polyethylene Glycol-Amino, DSPE-PEG-amine, CAS: 474922-26-4

VS2017 connects to MYSQL

Pytorch常用函数

活体检测CDCN学习笔记

wangeditor编辑器内容传至后台服务器存储

VS2017连接MYSQL
随机推荐
Understanding of objects and functions in js
softmax函数详解
Remote file xxx is mapped to the local path xxx and can‘t be found. You can continue debugging....
数据分析之SQL面试真题
应用usb_cam同时打开多个摄像头方法
超参数优化-摘抄
自然语言处理相关list
2022年SQL大厂高频实战面试题(详细解析)
Cholesterol-PEG-Thiol CLS-PEG-SH Cholesterol-Polyethylene Glycol-Sulfhydryl
钉钉H5微应用免登鉴权
Sourcery插件(自动提升代码质量)
cocos2d-x-3.2 image graying effect
四种常见的POST提交数据方式
【解决问题】RuntimeError: The size of tensor a (80) must match the size of tensor b (56) at non-singleton
Jupyter内核正忙、内核挂掉
化学试剂磷脂-聚乙二醇-氨基,DSPE-PEG-amine,CAS:474922-26-4
QT VS中双击ui文件无法打开的问题
2021-09-30
Podspec verification dependency error problem pod lib lint , need to specify the source
box-shadow相关属性