public AuthHelper(IConfigProvider configProvider) { clientId = configProvider.GetClientId(); scopes = configProvider.GetScopes(); if (string.IsNullOrWhiteSpace(configProvider.GetClientSecret())) { clientApplication = new PublicClientApplication(clientId, configProvider.GetAuthority(), TokenCacheHelper.GetUserCache()); isUserMode = true; } else { var clientCredential = new ClientCredential(configProvider.GetClientSecret()); clientApplication = new ConfidentialClientApplication(clientId, configProvider.GetAuthority(), configProvider.GetRedirectUri(), clientCredential, null, TokenCacheHelper.GetUserCache()); isUserMode = false; } }