Not Able to Get Applications Url for Skype for Business

后端 未结 4 977
走了就别回头了
走了就别回头了 2021-01-07 09:59

I\'m trying to use the REST API in Skype for Business Online by following the instructions here: https://msdn.microsoft.com/EN-US/library/office/mt590891(v=office.16).aspx.

4条回答
  •  星月不相逢
    2021-01-07 10:36

    Correct. When the results of calling the user resource does not include applications, it will include a redirect value. Here's an example:

    A call here:

    https://webdir0b.online.lync.com/Autodiscover/AutodiscoverService.svc/root/oauth/user
    

    May return the following:

    {"_links":{"self":{"href":"https://webdir0b.online.lync.com/Autodiscover/AutodiscoverService.svc/root/user"},"xframe":{"href":"https://webdir2a.online.lync.com/Autodiscover/AutodiscoverService.svc/root/xframe"},"redirect":{"href":"https://webdir2a.online.lync.com/Autodiscover/AutodiscoverService.svc/root"}}}
    

    Which includes this redirect

    "redirect":{"href":"https://webdir2a.online.lync.com/Autodiscover/AutodiscoverService.svc/root"}}}
    

    To continue, you'll then need to make an Azure AD auth call, passing ONLY the value of the protocol://servername as the resource. This means reducing the following:

    https://webdir2a.online.lync.com/Autodiscover/AutodiscoverService.svc/root
    

    To be just this:

    https://webdir2a.online.lync.com/
    

    Now that you have a valid token for webdir2a.online.lync.com, you'll then need to append "/oauth/user" to the re-direct URL. You'll notice the initial call included this in the URL whereas the redirect URL doesn't.

    Call the updated re-direct URL

    https://webdir2a.online.lync.com/Autodiscover/AutodiscoverService.svc/root/oauth/user
    

    And you should get what you're after:

    {"_links":{"self":{"href":"https://webpooldm12a04.infra.lync.com/Autodiscover/AutodiscoverService.svc/root/oauth/user"},"applications":{"href":"https://webpooldm12a04.infra.lync.com/ucwa/oauth/v1/applications","revision":"2"},"xframe":{"href":"https://webpooldm12a04.infra.lync.com/Autodiscover/XFrame/XFrame.html"}}}
    

    Which is the applications resource

    "applications":{"href":"https://webpooldm12a04.infra.lync.com/ucwa/oauth/v1/applications","revision":"2"}
    

    For the interested, I've created a .NET-based console app that demonstrates how to sign in to Skype for Business Online via the UCWA API - and in doing so, handles the autodiscovery process, re-directs, application creation, amongst other things.

提交回复
热议问题