Skype Web SDK can't sign in

时间:2019-01-15 18:14:15

标签: angular skypedeveloper

I'm following the MSDN guidance here to sign in from an Angular app to Skype Online.

Still, the client can't sign in, I get cannot sign in Error: GET https://webdir2e.online.lync.com/Autodiscover/AutodiscoverService.svc/root/oauth/user failed: Unauthorized

The same user and the same appId works within the Skype SDK web sample, so the issue can't be with Azure AD permissions.

It's very suspicious that as the app makes GET requests to https://webdir2e.online.lync.com/Autodiscover/AutodiscoverService.svc/root/oauth/user, I see that the Authorization header is flawed, as it shows as: Authorization: undefined undefined

Note that the app uses ADAL to access the Graph API - which works flawless.

My index.html contains the following code, basically copy & pasted from the guide and replaced the client_id:

<script src="https://swx.cdn.skype.com/shared/v/1.2.35/SkypeBootstrap.min.js"></script>
  <script>
    var config = {
      apiKey: '595a1aeb-e6dc-4e5b-be96-bb38adc83da1', // SDK
      apiKeyCC: '08c97289-7d57-404f-bd97-a6047403e370' // SDK+UI
    };
    var Application;
    var client_id = 'xxx';

    var hasToken = /^#access_token=/.test(location.hash);
    var hasError = /^#error=/.test(location.hash);

    // redirect to Org ID if there is no token in the URL
    if (!hasToken && !hasError) {
      location.assign('https://login.microsoftonline.com/common/oauth2/authorize?response_type=token' +
        '&client_id=' + client_id +
        '&redirect_uri=' + location.href +
        '&resource=https://webdir.online.lync.com');
    }

    // show the UI if the user has signed in
    if (hasToken) {
      Skype.initialize({
        apiKey: config.apiKey,
        correlationIds: {
          sessionId: 'mySession123', // Necessary for troubleshooting requests, should be unique per session
        }
      }, function (api) {
        app = new api.application();
        // the SDK will get its own access token
        app.signInManager.signIn({
          client_id: client_id,
          cors: true,
          redirect_uri: '/an/empty/page/for/ie.html',
          origins: ["https://webdir.online.lync.com/autodiscover/autodiscoverservice.svc/root"],
          version: 'meeting-scheduler/0.1' // Necessary for troubleshooting requests; identifies your application in our telemetry
        }).then(() => {
          console.log("signed in as", app.personsAndGroupsManager.mePerson.displayName());
        }, err => {
          console.log("cannot sign in", err);
        });;
      });
    }

    if (hasError) {
      console.log(location.hash);
    }

0 个答案:

没有答案