-
Notifications
You must be signed in to change notification settings - Fork 218
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
How to configure Microsoft.Identity.Web when Web App and Web API exist in the same project. #547
Comments
yes @levi106 : you need to call both. |
Does the call order matter? Calling AddMicrosoftIdentityWebApiAuthentication after AddMicrosoftIdentityWebAppAuthentication resulted in a 401 error.
|
@levi106, it does not but I think that you need to use the non-contracted from (AddAuthentication, AddMicrosoftIdentityWebApp, AddAuthenticationAddMicrosoftIdentityWebApi, and decide of which scheme (OpenIdConnect or JWT has the priority), and specify which scheme to use for which page / controller action. See details in The problematics is similar to this one: |
I tried to specify the scheme name for the Web API, but I got the same result.
|
@levi106 did you decorate the [Authorize] attribute for your HTML pages (Web app) and your api pages (web api) with the scheme ? did you read this article? Authorize with a specific scheme in ASP.NET Core |
See also https://github.com/AzureAD/microsoft-identity-web/wiki/Mixing-web-app-and-web-api-in-the-same-ASP.NET-core-app |
I looked at the document but couldn't figure out how to configure the following project.
Do I need to call AddMicrosoftIdentityWebAppAuthentication and also AddMicrosoftIdentityWebApiAuthentication?
The text was updated successfully, but these errors were encountered: