private async Task SilentAuthenticate() { if (authenticator == null) { InitAuthenticator(); } await authenticator.RestoreMostRecentFromCacheAsync(); client = new OneDriveClient("https://api.onedrive.com/v1.0", authenticator); }
public async Task ResotreAuthenticateUser() { byte[] cacheBlod = SettingsWorker.Current.GetCahceBlod(); if (cacheBlod == null) { return; } _credentialCache.InitializeCacheFromBlob(cacheBlod); _msaAuthenticationProvider = new MsaAuthenticationProvider(APP_ID, ReturnURL, _scopes, _credentialCache); try { await _msaAuthenticationProvider.RestoreMostRecentFromCacheAsync(); if (_msaAuthenticationProvider.IsAuthenticated) { _oneDriveClient = new OneDriveClient(BaseURL, _msaAuthenticationProvider); IsAuthenticated = true; } } catch { } }