How to Add Multi-Auth to ASP.NET Core

Viewed 31

disclaimer--this is my first time using .NET Core after taking over a site from another team so still learning. I have a client app called 3d with a web API. I am trying to hit the API through Postman because I have a requirement to be able to make the call from an external application without user input but it fails due to a pop up asking the user to sign into Azure: enter image description here

The call works successfully if I execute it through swagger locally (there's no auth on the calls themselves yet). The culprit seems to be in the startup file which redirects the user to the SSO page:

 services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
            .AddCookie(CookieAuthenticationDefaults.AuthenticationScheme, options =>
            {
                options.Cookie.Path = Configuration["SiteConfiguration:BasePath"];
                options.Cookie.Domain = Configuration["SiteConfiguration:Domain"];
            })
        .AddMicrosoftIdentityWebApp(Configuration.GetSection("AzureAd"),
            OpenIdConnectDefaults.AuthenticationScheme,
            "V3Cookie");

Is there a way to work around this and be able to hit the API through postman/code? Could I have a service account bypass it? Or is there a way to also do token auth?

Let me know if I can clarify anything, thanks

1 Answers
Related