locked
[UWP] OneDrive webcontrol needed? RRS feed

  • Question

  • Hi,

    I want to ask, if I want to use onedrive rest api, do I need to use webview/webbrowser control? Or is it possible to authenticate without it? I'd like to make wrapper for onedrive rest api.

    Many thanks


    • Edited by JP_MSDeveloper Tuesday, February 6, 2018 1:59 PM
    • Moved by Breeze Liu Thursday, March 1, 2018 6:17 AM off topic
    Tuesday, February 6, 2018 1:49 PM

All replies

  • You can access the low level API's with a WebView and an HttpClient, as explained in this article. Fortunately this is not mandatory if you use the Windows 10 SDK against the OneDrive REST API, which is explained in part 2 of that same article. Your app needs no extra UI for the authentication process.

    If you want to create a wrapper, you may find some inspiration in the UWP Community Toolkit OneDrive Service.

    Tuesday, February 6, 2018 3:01 PM
  • Thank you for your answer. What about Microsoft Graph? MSDN documentation recommends to use this approach.
    Tuesday, February 6, 2018 5:24 PM
  • As Diederik says, the general purpose API to talk to REST services from UWP is HttpClient. See https://docs.microsoft.com/en-us/windows/uwp/networking/httpclient and https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/HttpClient

    For general oAuth authentication use the WebAuthenticationBroker. See https://docs.microsoft.com/en-us/uwp/api/Windows.Security.Authentication.Web.WebAuthenticationBroker and https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/WebAuthenticationBroker

    For specific services you'll want to check in the appropriate documentation or forums for those services. They may also provide high level SDKs that wrap the REST calls.

    OneDrive docs: https://developer.microsoft.com/en-us/onedrive

    OneDrive discussion: see links in Support menu at https://developer.microsoft.com/en-us/onedrive

    Graph API docs: https://developer.microsoft.com/en-us/graph

    Graph API forum: https://social.msdn.microsoft.com/Forums/en-US/home?forum=WindowsAzureAD

    OneDrive login with Graph: https://docs.microsoft.com/en-us/onedrive/developer/rest-api/getting-started/graph-oauth

    Azure ActiveAD Authentication Library: https://github.com/AzureAD/azure-activedirectory-library-for-dotnet

    Microsoft Authentication Library (MSAL) Preview for .NET https://aka.ms/aaddev

    Tuesday, February 6, 2018 11:09 PM
  • Thank you. Now it is more clear to me. Just last question. What is the difference between Web authentication broker and Web account manager? Can both be used for onedrive authentication?
    Wednesday, February 7, 2018 7:20 AM
  • They both do essentially the same thing. Either should work for authentication, but for OneDrive specific answers you'll need to check with the onedrive forums.
    Tuesday, February 13, 2018 2:16 AM