private async Task GenerateBearerTokens(TestContext context)
        {
            var tokenProvider = new TokenProvider(Options.Create(context.WebConfig.AzureAdConfiguration));

            context.Token = await tokenProvider.GetClientAccessToken(context.WebConfig.AzureAdConfiguration.ClientId, context.WebConfig.AzureAdConfiguration.ClientSecret, context.WebConfig.VhServices.TestApiResourceId);

            context.Token.Should().NotBeNullOrEmpty();
        }
        private static async Task GenerateBearerTokens(TestContext context)
        {
            var azureAdConfigurationOptions = Options.Create(context.VideoWebConfig.AzureAdConfiguration);
            var tokenProvider = new TokenProvider(azureAdConfigurationOptions);

            context.Tokens.TestApiBearerToken = await tokenProvider.GetClientAccessToken(context.VideoWebConfig.AzureAdConfiguration.ClientId, context.VideoWebConfig.AzureAdConfiguration.ClientSecret, context.VideoWebConfig.VhServices.TestApiResourceId);

            context.Tokens.TestApiBearerToken.Should().NotBeNullOrEmpty();

            context.Tokens.CallbackBearerToken = GenerateTemporaryTokens.SetCustomJwTokenForCallback(context.VideoWebConfig.VideoWebKinlyConfiguration);
            context.Tokens.CallbackBearerToken.Should().NotBeNullOrEmpty();
        }
        private async Task GetClientAccessTokenForApi()
        {
            var configRootBuilder = new ConfigurationBuilder()
                                    .AddJsonFile("appsettings.json")
                                    .AddEnvironmentVariables()
                                    .AddUserSecrets <Startup>();

            var configRoot = configRootBuilder.Build();
            var azureAdConfigurationOptions = Options.Create(configRoot.GetSection("AzureAd").Get <AzureAdConfiguration>());
            var azureAdConfiguration        = azureAdConfigurationOptions.Value;

            var tokenProvider = new TokenProvider(azureAdConfigurationOptions);

            _bearerToken = await tokenProvider.GetClientAccessToken(azureAdConfiguration.ClientId, azureAdConfiguration.ClientSecret, azureAdConfiguration.ClientId);
        }