I have a custom Web API in dotnet core, I have secured the web api using [Authorize(Policy = "Admin")].
I have registered the web api in Azure AD using App Registration. I have created two application roles "Admin" and "Customer".
I have a console app which is registered as client in Azure AD using App Registration in Azure.
Now When I am requesting the access token using with scope- api://{guid}/.default (all permissions)
requesting OAuth 2.0 token endpoint (v2) -https://login.microsoftonline.com/{tenantID}/oauth2/v2.0/token
I am getting the access token, and I am able to call my web api method. But when I am calling the web api with thea specific scope say "Admin" scope: api://{guid}/Admin
I am getting error -
Error: Cound not complete OAuth 2.0 token request: "AADSTS70011: The provided request must include a 'scope' input parameter. The provided value for the input parameter 'scope' is not valid.The scope api://{guid}/Admin is not valid