当前位置:网站首页>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
边栏推荐
- DSPE-PEG-Thiol DSPE-PEG-SH 磷脂-聚乙二醇-巯基脂质体制备用
- Cholesterol-PEG-Acid CLS-PEG-COOH 胆固醇-聚乙二醇-羧基修饰肽类化合物
- pyspark.ml feature transformation module
- 用pytorch里的children方法自定义网络
- Hyperparameter Optimization - Excerpt
- ERROR Error: No module factory availabl at Object.PROJECT_CONFIG_JSON_NOT_VALID_OR_NOT_EXIST ‘Error
- MYSQL事务与锁问题处理
- Podspec verification dependency error problem pod lib lint , need to specify the source
- Cholesterol-PEG-NHS NHS-PEG-CLS cholesterol-polyethylene glycol-active ester can modify small molecular materials
- 超参数优化-摘抄
猜你喜欢

Session和Cookie,Token
![[已解决]ssh连接报:Bad owner or permissions on C:\\Users/XXX/.ssh/config](/img/53/8b5a12e7ed551dca52ada5dbb5d6b5.png)
[已解决]ssh连接报:Bad owner or permissions on C:\\Users/XXX/.ssh/config

VTK:Could not locate vtkTextRenderer object.

科学研究用磷脂-聚乙二醇-活性酯 DSPE-PEG-NHS CAS:1445723-73-8

CAS:474922-22-0 Maleimide-PEG-DSPE 磷脂-聚乙二醇-马来酰亚胺简述

mPEG-DSPE 178744-28-0 甲氧基-聚乙二醇-磷脂酰乙醇胺线性PEG磷脂

2021-09-30

Software Testing Interview Questions 2021

DSPE-PEG-Biotin,CAS:385437-57-0,磷脂-聚乙二醇-生物素可延长循环半衰期

多元线性回归方程原理及其推导
随机推荐
Cholesterol-PEG-Acid CLS-PEG-COOH Cholesterol-Polyethylene Glycol-Carboxyl Modified Peptides
Cholesterol-PEG-NHS NHS-PEG-CLS cholesterol-polyethylene glycol-active ester can modify small molecular materials
Pytorch实现ResNet
活体检测FaceBagNet阅读笔记
pytorch学习笔记10——卷积神经网络详解及mnist数据集多分类任务应用
解决background-size:cover时图片铺满但显示不完整?
mPEG-DSPE 178744-28-0 甲氧基-聚乙二醇-磷脂酰乙醇胺线性PEG磷脂
cocos2d-x-3.2 image graying effect
2022年SQL大厂高频实战面试题(详细解析)
CNN的一点理解
Embedding cutting-edge understanding
二进制转换成十六进制、位运算、结构体
Cholesterol-PEG-DBCO 胆固醇-聚乙二醇-二苯基环辛炔化学试剂
understand js operators
RuntimeError: CUDA error: no kernel image is available for execution on the device问题记录
VTK环境配置
日志jar包冲突,及其解决方法
Nmap的下载与安装
Pytorch常用函数
ERROR Error: No module factory availabl at Object.PROJECT_CONFIG_JSON_NOT_VALID_OR_NOT_EXIST ‘Error