Search code examples
c#identityserver4angular9

I keep getting error 404 on angular client side when trying to reach my api endpoint using identity server 4 for auth


Am working on a project using angular 9 as my client side, .net core 3.1 for API, and Identity server 4 for Authentication and authorization. On the client-side level, I can sign in using oidc for authentication and retrieving access tokens using implicit flow grand type. But whenever I try accessing the API endpoint after all necessary configurations without the authorization attributes on my controller I can access the data via the API endpoint, but whenever I add the authorization attribute on the controller I get a 404 HTTP error. What could possibly have gone wrong? Below is the snapshot of my code implementations and errors:

result when authorization attributes are removed from the controller header.

result when Authorization attribute is added to the API controller

error result continuation

error returned in detail

returned header

client configuration in Identity 4 server level

configuration contd

API configuration for the API

API call on the angular client side level

Signin redirect call back

The Authenticated Route Guard

User manager configuration

The http interceptor

The Authentication service

Auth service contd

Auth service contd

Auth contd

Auth contd

Auth contd

App Module Root Route

App module.ts

app module

Dashboard

FGTBILLS MODULe

api service to call the api endpoint

component the calls the gbnbondtbills service


Solution

  • After going through some research i found ou that I failed to add identity server default authentication scheme and default challenge scheme on the authentication pipeline on the API startup.cs level.

    enter image description here