开发者社区> 问答> 正文

调取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 6126 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
JavaScript面向对象的程序设计 立即下载
Delivering Javascript to World 立即下载
编程语言如何演化-以JS的private为例 立即下载