OneDrive / onedrive-sdk-dotnet-msa-auth-adapter

Other
26 stars 22 forks source link

Use MsaAuthenticationProvider from a C++/MFC Client #61

Closed WolfgangGogg closed 6 years ago

WolfgangGogg commented 6 years ago

Hello, for a project we need to integrate OneDrive into our C++/MFC Client. To be able to do so we have put a Managed C++/CLI DLL in place which calls a C# DLL that finally uses the OneDrive API (C#). But i am horribly failing in getting MsaAuthenticationProvider to work in this scenario. Especially becuase i can not solve the Deadlock issue when using an async funciton from synchronous code, which unfortunately C++/MFC code is. I do not find any way to get AuthenticateUserAsync() to work. Either it deadlocks because i need to wait in my UI thread on the results of the async funciton (this is a known problem i know). And when i try to call it from a STA Thread specifically created it fails too because it uses WinForms and hence fails to create the authentication UI in a background thread. Other (BOX, Dropbox, ...) have solved that by using WPF or options to define a custom UI for the browser control, but also this does not seem to be possible. Do i have any chance to get this working in my heterogenous environment (C++ --> Managed C++/CLI --> C# DLL --> OneDrive API)? Thanks for any feedback! Thanks!

WolfgangGogg commented 6 years ago

Hello, nevermind think i found a solution by directly using the OAuthHelper class instead of the MsaAuthenticationProvider. Here i can easily plugin my own UI implementing IWebAuthenticationUi based on WPF probably which should solve my issues. Thanks anyway!