We are using the OneDrive SDK inside our UWP application.
To login the user, we use the following code:
OnlineIdAuthenticationProvider msaAuthenticationProvider = new OnlineIdAuthenticationProvider(
new[] { "onedrive.readwrite" });
try
{
await msaAuthenticationProvider.AuthenticateUserAsync();
m_oneDriveClient = new OneDriveClient("https://api.onedrive.com/v1.0", msaAuthenticationProvider);
}
catch (Exception e)
{
s_log.ErrorFormat("OneDrive authentication failed: {0}", e.Message);
}
In most of the cases, the login is successful.
Apparently, in cases when the user is an Administrator under a specific company domain, this method doesn't work and we are facing the following exception:
Exception of type 'Microsoft.Graph.ServiceException' was thrown
Obviously the credentials used by the user are correct and verified.
The credentials relate to a private account, which is NOT the one used to login into the Windows machine, BUT still is a recognized Microsoft account used e.g. to link OneDrive to the vary same machine (in fact, the user is able to see her files under Windows File Explorer / OneDrive!).
So I have the following questions:
- why only for specific users a login popup appears, while for others (e.g. private accounts) the login is automatic.
- how can we force the SDK to display the login popup.
- why there is an exception (and related authentication failure) for such credentials configuration.
Thank you!