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); }
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); }
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); }