简体   繁体   English

Skype Web SDK登录无法正常工作

[英]Skype Web SDK Sign in not working

I'm using the Skype SDK entry point source from https://msdn.microsoft.com/EN-US/library/dn962162(v=office.16).aspx and trying to sign into Skype but I keep hitting an issue with one of the Skype functions. 我正在使用来自https://msdn.microsoft.com/zh-CN/library/dn962162(v=office.16).aspx的Skype SDK入口点源,并尝试登录Skype,但我一直遇到以下问题Skype功能之一。 I currently have 2 text fields both, which have its own ID values (#username and #password) and I have 2 buttons (#signin and #signout). 我目前有2个文本字段,它们都有自己的ID值(#username和#password),我有2个按钮(#signin和#signout)。

    <script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'></script>
<SCRIPT type='text/javascript' SRC='https://swx.cdn.skype.com/shared/v/1.1.23.0/SkypeBootstrap.min.js'></SCRIPT>
    <TABLE CLASS='test'>
<TR><TD ALIGN=RIGHT><INPUT TYPE=TEXT class=suptabde NAME="username" ID="username" VALUE="" MAXLENGTH=40 style="width:18em">
<INPUT TYPE=PASSWORD class=testtabde NAME="password" VALUE="" MAXLENGTH=40 style="width:18em">
<BUTTON id='signin' class='testtabde' STYLE='text-align:center' VALUE='  Skype Login  '>Log in</BUTTON><BUTTON id='signout' class='suptabde' STYLE='text-align:center' VALUE='  Skype Login  '>Log out</BUTTON>
</TABLE>

I have taken a copy of the js content from the msdn website, which looks like the following, 我从msdn网站上获取了js内容的副本,如下所示:

$(function () {
    'use strict';    // create an instance of the Application object;
    // note, that different instances of Application may
    // represent different users
    var Application
    var client;
    Skype.initialize({
        apiKey: 'SWX-BUILD-SDK',
    }, function (api) {
        Application = api.application;
        client = new Application();
    }, function (err) {
        alert('some error occurred: ' + err);
    });
    // whenever state changes, display its value    
    client.signInManager.state.changed(function (state) {
        $('#application_state').text(state);
    });
    // when the user clicks on the "Sign In" button    
    $('#signin').click(function () {
    // start signing in
    client.signInManager.signIn({
        username: $('#username').text(),
        password: $('#password').text()
    }).then(
        //onSuccess callback
        function () {
            // when the sign in operation succeeds display the user name
            alert('Signed in as ' + client.personsAndGroupsManager.mePerson.displayName());
        }, 
        //onFailure callback
        function (error) {
            // if something goes wrong in either of the steps above,
            // display the error message
            alert(error || 'Cannot sign in');
        });
    });

// when the user clicks on the "Sign Out" button
$('#signout').click(function () {
    // start signing out
    client.signInManager.signOut()
        .then(
            //onSuccess callback
            function () {
                // and report the success
                alert('Signed out');
            }, 
        //onFailure callback
        function (error) {
            // or a failure
            alert(error || 'Cannot sign in');
        });
});
});

When loading up my html page the error I get following error, "Uncaught TypeError: Cannot read property 'signInManager' of undefined". 当加载我的html页面时,出现以下错误:“未捕获的TypeError:无法读取未定义的属性'signInManager'”。 The line it points at with the error is "client.signInManager.state.changed(function (state) {". I can see that 'signInManager' is in the SDK-build.js file, which is picked up by the source correctly from swx.cdn.skype.com/vs/SDK-build.js so I'm not sure how to get around this, has anyone got any ideas on how to resolve this issue? 它所指向的带有错误的行是“ client.signInManager.state.changed(function(state){”。我可以看到'signInManager'在SDK-build.js文件中,该文件正确地被源代码拾取了来自swx.cdn.skype.com/vs/SDK-build.js,所以我不确定如何解决此问题,有人对解决此问题有任何想法吗?

Issue seemed to be related to 2 references to the jquery library, one, which was older than the other. 问题似乎与对jquery库的2个引用有关,一个引用比另一个引用早。 Have removed the old reference and the error message has now gone. 删除了旧的参考,错误消息现在消失了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM