[Bug] Using RequiredScope Attribute on APIController Causes 500 Response #1223
Labels
bug
Something isn't working
duplicate
This issue or pull request already exists
regression
regression between Microsoft Identity Web versions
Milestone
Which version of Microsoft Identity Web are you using?
1.10.0
Note that to get help, you need to run the latest version.
Where is the issue?
Is this a new or an existing app?
App in development, not in production yet, upgraded to new version of Microsoft Identity Web.
Repro
I have the following in appsettings.json:
I am trying to use the following attribute at the controller level:
[RequiredScope(RequiredScopesConfigurationKey = "AzureAd:Scopes")]
Expected behavior
Expected that the scope is verified for all methods in the controller and the API methods are reached.
Actual behavior
When the UI calls this API it first gets a token successfully then calls the API. I put a breakpoint on the controller method that gets called. The breakpoint is not reached but a 500 status with a message of Internal Server Error is returned to the UI.
If I revert to the following code, everything works properly:
static readonly string[] scopeRequiredByApi = new string[] { "user_impersonation" }; HttpContext.VerifyUserHasAnyAcceptedScope(scopeRequiredByApi);
Possible solution
Additional context / logs / screenshots
Add any other context about the problem here, such as logs and screenshots.
The text was updated successfully, but these errors were encountered: