开发者社区> 问答> 正文

调取js-api授权时报错求指教

已能运行到dd.ready里,但马上弹出错误 fail:{“errorMessage”:"null, err msg redirect_uri domain is not secure domain","errorCode":3}





<script type="text/javascript" src="../../js/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="https://g.alicdn.com/ilw/ding/0.6.6/scripts/dingtalk.js"></script>
    <script type="text/javascript" >
        dd.config({
            appId: '<%= appId%>',
            corpId: '<%= corpId%>',
            timeStamp: <%= timestamp%>,
            nonceStr: '<%= nonceStr%>',
            signature: '<%= signature%>',
            jsApiList: ['runtime.info',
        'biz.contact.choose',
        'device.notification.confirm',
        'device.notification.alert',
        'device.notification.prompt',
        'biz.ding.post']
        });
        dd.ready(function () {
            //dd.runtime.info({
            //    onSuccess: function (info) {
            //        alert('runtime info: ' + JSON.stringify(info));
            //    },
            //    onFail: function (err) {
            //        alert('fail: ' + JSON.stringify(err));
            //    }
            //});
            logger.i('dd.ready rocks!');
            dd.runtime.permission.requestAuthCode({
                corpId:  '<%= corpId%>',
                onSuccess: function (info) {
                    alert('authcode: ' + info.code);
                    $.ajax({
                        url: '../../Ajax/DingHandler.ashx?method=getuserinfo&code=' + info.code,
                        type: 'GET',
                        success: function (data, status, xhr) {
                                alert(data);
                        },
                        error: function (xhr, errorType, error) {
                            alert(errorType + ', ' + error);
                        }
                    });
                },
                onFail: function (err) {
                    alert('fail: ' + JSON.stringify(err));
                }
            });
        });


        dd.error(function (err) {
            alert('dd error: ' + JSON.stringify(err));
        });
    </script>

展开
收起
maxzheng 2016-01-12 18:01:50 6129 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
Spring Boot2.0实战Redis分布式缓存 立即下载
CUDA MATH API 立即下载
API PLAYBOOK 立即下载