/// <summary> /// Logic to build an <see cref="AppCredentials"/> object to be used to acquire tokens /// for this HttpClient. /// </summary> /// <param name="appId">The application id.</param> /// <param name="oAuthScope">The optional OAuth scope.</param> /// <returns>The app credentials to be used to acquire tokens.</returns> protected virtual async Task <AppCredentials> BuildCredentialsAsync(string appId, string oAuthScope = null) { var appPassword = await CredentialProvider.GetAppPasswordAsync(appId).ConfigureAwait(false); return(ChannelProvider != null && ChannelProvider.IsGovernment() ? new MicrosoftGovernmentAppCredentials(appId, appPassword, HttpClient, Logger, oAuthScope) : new MicrosoftAppCredentials(appId, appPassword, HttpClient, Logger, oAuthScope)); }