How to get access token with Azure.Identity.AuthenticationFailedException....
Hi
I am trying to access my app on Azure to give me an Access Token. However there seems to be no way of avoiding this error:
Azure.Identity.AuthenticationFailedException: 'InteractiveBrowserCredential authentication failed: '
MsalServiceException: AADSTS650057: Invalid resource. The client has requested access to a resource which is not listed in the requested permissions in the client's application registration.
This is the code which is firing up the credential browser, but then crashes when the Asyc returns...
All the permissions seems to be register in Microsoft_AAD_RegisteredApps, i.e. in the portal....
credential = new InteractiveBrowserCredential(
new InteractiveBrowserCredentialOptions
{
TokenCachePersistenceOptions = new TokenCachePersistenceOptions { Name = TOKEN_CACHE_NAME},
ClientId = clientId,
TenantId = tenantId,
RedirectUri = new Uri("https://localhost/")
});
//
// Call AuthenticateAsync to fetch a new AuthenticationRecord.
var authRecord = credential.AuthenticateAsync().SyncResult();
```All the permissions seems to be register in Microsoft_AAD_RegisteredApps, i.e. in the portal....