Ejemplo n.º 1
0
        private async Task SilentAuthenticate()
        {
            if (authenticator == null)
            {
                InitAuthenticator();
            }
            await authenticator.RestoreMostRecentFromCacheAsync();

            client = new OneDriveClient("https://api.onedrive.com/v1.0", authenticator);
        }
Ejemplo n.º 2
0
        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 { }
        }