38 lines
1.0 KiB
HTML
38 lines
1.0 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8"/>
|
|
<meta content="IE=edge" http-equiv="X-UA-Compatible"/>
|
|
<meta
|
|
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"
|
|
name="viewport"
|
|
/>
|
|
<title>钉钉授权</title>
|
|
</head>
|
|
<body>
|
|
<script src="dingtalk.open.js"></script>
|
|
<script type="text/javascript">
|
|
|
|
function getQueryString(name) {
|
|
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
|
|
var r = window.location.search.substr(1).match(reg);
|
|
if (r != null) return decodeURI(r[2]);
|
|
return null;
|
|
}
|
|
|
|
dd.runtime.permission.requestAuthCode({
|
|
corpId: getQueryString("corpId"),
|
|
onSuccess: function (result) {
|
|
let search = window.location.search + "&code=" + result.code;
|
|
window.location.href = "/auth/ding/oauth2/" + getQueryString("service") + search;
|
|
},
|
|
onFail: function (err) {
|
|
window.location.href = "./error.html?message=" + JSON.stringify(err);
|
|
}
|
|
})
|
|
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|