报错内容:
权限校检失败
code:52011;
Message:jsapi ticket 读取失败
errorCode:3
下面为我的前端代码:
=====================================================================================================================
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>
<script type="text/javascript" src="https://g.alicdn.com/ilw/ding/0.9.2/scripts/dingtalk.js"></script>
<style>
*{
margin: 0;
padding: 0;
}
#userName{
width: 100%;
height: 50px;
border: 1px solid red;
}
#userId{
width: 100%;
height: 50px;
border: 1px solid red;
}
#btn{
width: 100%;
height: 100px;
}
</style>
</head>
<body>
<button type="button" id="btn">请求数据</button>
<div id="userName"></div>
<div id="userId"></div>
<script>
$("#btn").on("click", function () {
$.getJSON("http://******.com/initcs/ding", function (datas) {
alert(datas.signature)
dd.config({ //dd.config方法会对参
agentId : datas.agentId,
corpId : datas.corpId,
timeStamp : datas.timeStamp,
nonceStr : datas.nonceStr,
signature : datas.signature,
type:0,
jsApiList : [ //需要调用的借口列表
'runtime.info',
'device.notification.prompt',
'biz.chat.pickConversation',
'device.notification.confirm',
'device.notification.alert',
'device.notification.prompt',
'biz.chat.open',
'biz.util.open',
'biz.user.get',
'biz.contact.choose',
'biz.telephone.call',
'biz.ding.post' ]
});
dd.ready(function () { //验证成功
dd.runtime.info({
onSuccess : function(info) {
logger.e('runtime info: ' + JSON.stringify(info));
},
onFail : function(err) {
logger.e('fail: ' + JSON.stringify(err));
}
});
dd.runtime.permission.requestAuthCode({ //获取code
corpId:datas.corpId,
onSuccess: function (info) {
alert('authcode: ' + info.code);
$.ajax({
url: 'userinfo?code=' + info.code + '&corpid=' //请求后台通过code值获得userId
+ datas.corpId,
type: 'GET',
success: function (data, status, xhr) {
var info = JSON.parse(data);
document.getElementById("userName").innerHTML = info.name;
document.getElementById("userId").innerHTML = info.userid;
},
error: function (xhr, errorType, error) {
logger.e("yinyien:" + datas.corpId);
alert(errorType + ', ' + error);
}
});
},
onFail: function (err) {
alert('fail: ' + JSON.stringify(err));
}
});
});
dd.error(function (err) { //验证失败
alert("进入到error中");
document.getElementById("userName").innerHTML = "验证出错";
alert('dd error: ' + JSON.stringify(err));
});
})
});
</script>
</body>
</html>
===============================================================================================
求各位帮忙解决一下 拜谢
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。