Angular 8 + asp.net webapi Azure Ad implicit authentication

99 views Asked by At

I have angular 8 application and asp.net webapi (not asp.net core). I need to have azure ad implicit authentication for both UI and web api, Is it necessary to have like , if we are using angular applications, then we should have ASPNET CORE as the API part or simple ASP.NET WEBAPI is enough. Now , i have secured the angular 8 with msadalangular6 and webapi with WindowsAzureActiveDirectoryBearerAuthenticationOptions. But on calling the webapi I am getting 401 unauthorized error. The bearer token is getting attached from the UI .I could see the Authroization : bearer eye... in the httpheaders

WEBAPI

var azureADBearerAuthOptions = new WindowsAzureActiveDirectoryBearerAuthenticationOptions
            {
                Tenant=value,
            };

            azureADBearerAuthOptions.TokenValidationParameters = new TokenValidationParameters()
            {
                ValidAudience =value
            };
            app.UseWindowsAzureActiveDirectoryBearerAuthentication(azureADBearerAuthOptions);

  ? MsAdalAngular6Module.forRoot({
          tenant: ,
          clientId: ,
          redirectUri: ,
          cacheLocation: ,
          Domain: ,
          navigateToLoginRequestUrl: ,
          endpoints: {
           APIURL: API ENDPOINT
             },
             authority: https://login.microsoftonline.com/TENANT/,
        })


0

There are 0 answers