I am following this microsoft tutorial to integrate web app with azure ad for sign in/sign out.
https://learn.microsoft.com/en-us/entra/identity-platform/tutorial-web-app-dotnet-call-api?tabs=visual-studio%2Cdotnet6
I created a sample .net core razor page web app and ran the web app using https localhost:7100 and it worked fine.
Then I modified the app as it given in the tutorials. Deleted the dummy code and added the sample code, setup client ID,tenant ID, certification key etc. I have followed all steps as is given in the documentation.
The problem is when i run the web app as https it gives me 404 error.
Let's create a new .net core web app, please don't forget to choose
Microsoft Identity platformas the Authentication Type.Then we need to follow the tutorial to replace the
builder.Services.AddAuthenticationwith codes below.This will bring build error on
AddDownstreamApi, let's installMicrosoft.Identity.Web.DownstreamApi" Version="2.15.2" />nuget package to solve it, by the way, we can upgrade the other packages as well. Open the csproj file(doule click the project name in vs), then the content should look like this now. Modify the file and rebuild the app to resolve the error.Modify the Index.cshtml and Index.cshtml.cs to add API calling codes and the html content to display API response.
Then we need to modify appsettings.json file to complete the configurations. Here we require an Azure AD application which already configured the redirect url and created client secret. In Azure AD -> your registration app -> Authentication blade, we should add
https://localhost/signin-oidcto theWebplatform. And inCertificates & secretsblade, we should create our client secret, then the appsettings.json should be modified toThen running your app, you would be asked to sign in, and getting below home page after logining in.