Vijay Pratap Singh

Vijay Pratap Singh

  • 346
  • 4.5k
  • 372.1k

Call To ApplicationTokenProvider.LoginSilentAsync method not return?

Nov 24 2022 10:19 AM

I am using ApplicationTokenProvider.LoginSilentAsync method in a web job but It is not returning anything and just getting terminated without throwing any exception. In the below-given code ApplicationTokenProvider.LoginSilentAsync method is not returning anything it just terminates in this method.

private static async Task<IAzureMediaServicesClient> CreateMediaServicesClientAsync(ConfigWrapper config)
        {
            var credentials = await GetCredentialsAsync(config);

            return new AzureMediaServicesClient(config.ArmEndpoint, credentials)
            {
                SubscriptionId = config.SubscriptionId,
            };
        }

        private static async Task<ServiceClientCredentials> GetCredentialsAsync(ConfigWrapper configWrapper)
        {
            ClientCredential clientCredential = new ClientCredential(configWrapper.AadClientId, configWrapper.AadSecret);
            ServiceClientCredentials creds = await ApplicationTokenProvider.LoginSilentAsync(configWrapper.AadTenantId, clientCredential, ActiveDirectoryServiceSettings.Azure).ConfigureAwait(false);
            return creds;
        }