public async Task Authenticate() { var msaAuthenticationProvider = new OnlineIdAuthenticationProvider(new string[] { "onedrive.readwrite" }); await msaAuthenticationProvider.AuthenticateUserAsync(); client = new OneDriveClient("https://api.onedrive.com/v1.0", msaAuthenticationProvider); }
/* * Authentification to OneDrive */ public static async Task <bool> OneDriveAuthentification() { try { var msaAuthenticationProvider = new OnlineIdAuthenticationProvider(scopes); if (!msaAuthenticationProvider.IsAuthenticated) { await msaAuthenticationProvider.AuthenticateUserAsync(); await msaAuthenticationProvider.RestoreMostRecentFromCacheOrAuthenticateUserAsync(); TabsDataCache.OneDriveClient = new OneDriveClient("https://api.onedrive.com/v1.0", msaAuthenticationProvider); TabsDataCache.AuthProvider = msaAuthenticationProvider; return(true); } else { return(true); } } catch { return(false); } }
public async Task Initialize() { try { if (initializationInProgress) { return; } initializationInProgress = true; var msaAuthenticationProvider = new OnlineIdAuthenticationProvider(new[] { "onedrive.readwrite", "wl.signin" }); await msaAuthenticationProvider.AuthenticateUserAsync(); oneDriveClient = new OneDriveClient("https://api.onedrive.com/v1.0", msaAuthenticationProvider); notInitialized = false; await MoveFromOldFolder(); } catch { notInitialized = true; } }
public async Task AuthenciateAccount() { await msaAuthenticationProvider.AuthenticateUserAsync(); }