I am trying to Authenticate using Postman to obtain Azure AD bearer token, then send token to my local WebApi .net Core server, which should validate the token and send request to Graph API. But for last couple of hours I am stuck at this error.
Microsoft.Identity.Client.MsalUiRequiredException: AADSTS65001: The user or administrator has not consented to use the application with ID 'b6590b93-aeba-45e1-b337-f52695e3647e' named 'RegistryCrawlePublicWebApi'. Send an interactive authorization request for this user and resource.
Azure Portal API Permissions:
namespace WebApiUsingGraphApi.Controllers
{
[Authorize]
[ApiController]
[Route("[controller]")]
public class GraphCallsController : ControllerBase
{
private readonly GraphApiClientDirect _graphApiClientDirect;
public GraphCallsController(GraphApiClientDirect graphApiClientDirect)
{
_graphApiClientDirect = graphApiClientDirect;
}
[HttpGet]
public async Task<string> Get()
{
var user = await _graphApiClientDirect.GetGraphApiUser()
.ConfigureAwait(false);
// var photo = await _graphApiClientDirect.GetGraphApiProfilePhoto();
// var file = await _graphApiClientDirect.GetSharepointFile();
return user.DisplayName;
}
}
}
Startup.cs
services.AddMicrosoftIdentityWebApiAuthentication(Configuration)
.EnableTokenAcquisitionToCallDownstreamApi()
.AddInMemoryTokenCaches();



