I followed this tutorial to generate an access token from client app for target app. According to the comment for this tutorial, for the resources
, I changed to App ID URL. But I am still not able to successfully generate bearer token for the target app.
It shows this error message:
AdalException: {"error":"invalid_request","error_description":"AADSTS90002: Tenant '' not found. This may happen if there are no active subscriptions for the tenant....}
Anyone knows what else I missed?
For me the issue was resolved by using older version of Microsoft.IdentityModel.Clients.ActiveDirectory. I had to used 3.13.8 version. Latest version has issues.
Using ADAL to get access token using client credential flow :
AuthenticationContext authenticationContext =
new AuthenticationContext("https://login.microsoftonline.com/<tenantId>");
ClientCredential clientCredential = new ClientCredential(clientId, appKey);
AuthenticationResult result =
await authenticationContext.AcquireTokenAsync("https://resourceUrl",
clientCredential);
Reference : https://github.com/AzureAD/azure-activedirectory-library-for-dotnet/wiki/Client-credential-flows
And document : Service to service calls using client credentials
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With