コード例 #1
0
        public static async Task <IGraphServiceClient> GetApi(AccountSession accountSession)
        {
            var authProvider = new OneDriveAuthenticationProvider(
                OneDriveClientId,
                OneDriveClientSecret);

            await authProvider.AuthenticateByAccountSessionAsync(accountSession);

            var httpProvider = new HttpProvider(ProxyTools.CreateHttpClientHandler(), true);
            var api          = new GraphServiceClient(ApiUrl, authProvider, httpProvider);

            return(api);
        }
コード例 #2
0
        public static async Task <IGraphServiceClient> GetApi(AccountConfiguration account)
        {
            if (Cache.ContainsKey(account.Id))
            {
                return(Cache[account.Id]);
            }

            var authProvider = new OneDriveAuthenticationProvider(
                OneDriveClientId,
                OneDriveClientSecret);

            await authProvider.AuthenticateByRefreshTokenAsync(account.Secret);

            var httpProvider = new HttpProvider(ProxyTools.CreateHttpClientHandler(), true);
            var api          = new GraphServiceClient(ApiUrl, authProvider, httpProvider);

            Cache.Add(account.Id, api);

            return(api);
        }
コード例 #3
0
ファイル: OneDriveHelper.cs プロジェクト: ydov/KeeAnywhere
        public static async Task <IGraphServiceClient> GetApi(AccountConfiguration account)
        {
            if (Cache.ContainsKey(account.Id))
            {
                return(Cache[account.Id]);
            }

            var authProvider = new OneDriveAuthenticationProvider(CreateOidcFlow(), account.Secret);

            var httpProvider = new HttpProvider(ProxyTools.CreateHttpClientHandler(), true)
            {
                OverallTimeout = Timeout.InfiniteTimeSpan
            };

            var api = new GraphServiceClient(authProvider, httpProvider);

            Cache.Add(account.Id, api);

            return(api);
        }