Not Able to Get Applications Url for Skype for Business

后端 未结 4 895
走了就别回头了
走了就别回头了 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.

    0 讨论(0)
  • 2021-01-07 10:39

    (Am I really replying to Steve Pescka? :o)

    In my case performing GET on the user resource
    GET https://webdir0e.online.lync.com/Autodiscover/AutodiscoverService.svc/root/oauth/user?originalDomain=contoso.onmicrosoft.com

    returns the following

     <resource rel="user" href="https://webpoolam30e08.infra.lync.com/Autodiscover/AutodiscoverService.svc/root/oauth/user" xmlns="http://schemas.microsoft.com/rtc/2012/03/ucwa">  
       <link rel="applications" href="https://webpoolam30e08.infra.lync.com/ucwa/oauth/v1/applications" revision="2" />
       <link rel="xframe" href="https://webpoolam30e08.infra.lync.com/Autodiscover/XFrame/XFrame.html" />
     </resource>
    

    So it contains the URI for applications resource, where to POST in order to create your application. I have an O365 E5 license

    0 讨论(0)
  • 2021-01-07 10:41

    I'll try and answer as short as possible - I got this working. 1st issue - when you don't get "applications" in the result, you should have a "redirect" value instead. Keep following that and doing your GET against it (using the process of getting access tokens and adding the auth header) and eventually you should get the applications Url. 2nd issue - after you get your applications URL, you need to go get another access token and use the host name of the applications URL as the resource ID. Then you can post and create your app. Really hope this helps someone. :-)

    0 讨论(0)
  • 2021-01-07 10:41

    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.

    I make the first call to the discovery service, and then get the discovery URL back for the user; it looks like this for me: https://webdir0b.online.lync.com/Autodiscover/AutodiscoverService.svc/root/oauth/user

    I then make the call to Azure and successfully get an access token back for https://webdir0b.online.lync.com. The next step is where things break down - I make a request again to the discovery Url for the user and include the access token. I get 500 - Internal server error.There is a problem with the resource you are looking for, and it cannot be displayed.

    0 讨论(0)
提交回复
热议问题