I have a web app hosted as an Azure app service that I am trying to authorize to an API also hosted as an Azure app service. I have registered both the app and the API, configured single-tenant AD authentication, authorized the client application, and have successfully obtained a bearer token. However, when I attempt to access a resources I receive a 401 error.
I've tried this using both delegated and application roles with no effect.
EDIT: Here is the code I'm using to obtain the token in my web app:
var confidentialClient = ConfidentialClientApplicationBuilder.Create(<clientId>)
.WithCertificate(<certificate>)
.WithAuthority(<authority>)
.Build();
await app.AcquireTokenForClient(new string[] { "api://<app_id>/.default" });
EDIT: After parsing the JWT token I've confirmed that the application role is present; however the scopes are not. Seems this should not be a problem though.
What are some steps I can take to try to diagnose this authentication problem?


