asp.net core webapi

IdentityServer4 not re-requesting token from Angular client  #angularjs #reactjs

  • Use the method to add services to the container public void ConfigureServices(IServiceCollection services) { services.
  • AddMvc(); } // This method gets called by the runtime.
  • It then uses the token in the auth header and it logs in.
  • I can tell CORS is working, I feel like I’m missing something really obvious in my IdentityServer config that should be re-requesting the token each time.
  • The issue I have run into is that as soon as I place the [Authorize] attribute on any of the controllers, the WebAPI app returns a 401 response and that makes the angular app go into a refresh loop as that is what is coded in the Angular Interceptors Service (redirect to “/” on 401).

I am working on porting an existing Angular 1.5 client from a working Rubi API to a new .NET Core Web API project as a learning exercise. The Rubi API and Angular client were using JWT for authentication. In my new .NET project the initial logon request is working, Angular sends an HttpOptions request and gets a JWT token back as a response. It then uses that token in the auth header and it logs in.

@ng_real_ninja: IdentityServer4 not re-requesting token from Angular client #angularjs #reactjs

I am working on porting an existing Angular 1.5 client from a working Rubi API to a new .NET Core Web API project as a learning exercise. The Rubi API and Angular client were using JWT for authentication. In my new .NET project the initial logon request is working, Angular sends an HttpOptions request and gets a JWT token back as a response. It then uses that token in the auth header and it logs in.

The issue I have run into is that as soon as I place the [Authorize] attribute on any of the controllers, the WebAPI app returns a 401 response and that makes the angular app go into a refresh loop as that is what is coded in the Angular Interceptors Service (redirect to “/” on 401). The Web API responds with a 401 each time, never requesting the token again from what I can see in the request/response traffic from fiddler.

I can tell CORS is working, I feel like I’m missing something really obvious in my IdentityServer config that should be re-requesting the token each time. Any ideas?

asp.net core webapi