From my local PC I'm trying to connect to the AzureBillingAPI using the following code :
var serviceCreds = await ApplicationTokenProvider.LoginSilentAsync(tenantDomain, clientId, secret);
This methods never returns. Debug output displays the following :
Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : 07/03/2017 14:02:07: e608ec23-675f-4828-aa65-72479409ec63 - TokenCache: Looking up cache for a token...
iisexpress.exe Information: 0 : 07/03/2017 14:02:07: e608ec23-675f-4828-aa65-72479409ec63 - TokenCache: Looking up cache for a token...
Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : 07/03/2017 14:02:07: e608ec23-675f-4828-aa65-72479409ec63 - TokenCache: No matching token was found in the cache
iisexpress.exe Information: 0 : 07/03/2017 14:02:07: e608ec23-675f-4828-aa65-72479409ec63 - TokenCache: No matching token was found in the cache
Question: how do I connect ? Thanks.
According to your description, I guess the reason why this methods never returns is you called the async method in the sync Controller method with wait keywords.
If you call the getResultAsync as below, it will never return the result :
I suggest you could change the index method as below, it will work well:
Result: