Closed JoshCaba closed 4 years ago
Thanks for contacting us.
It looks like the error you're getting is because the result of the HTTP call is not really a 200 OK. Based on the logs, the server is returning a ChallengeResponse
. On the client, because you're not validating the return code, the code tries to parse that HTML content as JSON and fails.
We are actually working on providing proper Azure AD enabled Blazor Project template as part of https://github.com/dotnet/aspnetcore/issues/17014. That should simplify the integration for you. I'm going to close this issue as that work is going to obsolete this particular issue.
Describe the bug
AD Authentication Not Passing Over Credentials with Blazor.
Creating an app that uses AD Azure Authentication and start using Blazor within it. Methods start to fail out whenever you call the controllers that require the AD authentication.
To Reproduce
Create a new Blazor Server App project. Ensure AD authentication is enabled in the "Authentication" portion of the new project dialog.
Add a New Controller with the following Method.
Add something on the front end to grab from the URL.
Output From the Console
The Exception
Although, this means nothing because all it's saying is that there's an HTML response coming back instead of JSON so it errors out. The console output from above is far more telling.