调用civicSip.signup函数时获取401(未经授权)

时间:2019-05-27 13:15:48

标签: javascript

我正尝试致电

civicSip.signup({ style: 'popup', scopeRequest:civicSip.ScopeRequests.BASIC_SIGNUP });

这是我的完整代码:

    var civicSip = new civic.sip({ appId: 'XXXXXXXX' });        
    var button = document.querySelector('#signupButton');
    if (button) {            
        button.addEventListener('click', function () {
            civicSip.signup({ style: 'popup', scopeRequest: civicSip.ScopeRequests.BASIC_SIGNUP });
        });
    }         
    civicSip.on('auth-code-received', function (event) {
        console.log('auth-code-received',event)          
        var jwtToken = event.response;            
        sendAuthCode(jwtToken);
    });

    civicSip.on('user-cancelled', function (event) {
        console.log('user-cancelled',event)            
    });

    civicSip.on('read', function (event) {
        console.log('read',event)            
    });

    civicSip.on('civic-sip-error', function (error) {        
        console.log('   Error type = ' + error.type);
        console.log('   Error message = ' + error.message);
    });

完整错误:

POST https://api.civic.com/sip/prod/scopeRequest/qrcode 401 (Unauthorized)

我正在关注这份https://docs.civic.com/#Browser文档,如果我做错了,请帮助我。enter image description here

0 个答案:

没有答案