-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Using RequiredScope Attribute on APIController Causes 500 Response #1223
Comments
@jennyf19 I could repro it easily by replacing in [RequiredScope("access_as_user")] by [RequiredScope(RequiredScopesConfigurationKey = "AzureAd:Scopes")] in the The call stack is: System.Net.Http.HttpRequestException Source=Microsoft.Identity.Web |
It's also a duplicate of #1036 |
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: