Passing HTTP Headers with retrieval of loadChildren files

6 views
Skip to first unread message

olp455...@gmail.com

unread,
Sep 19, 2017, 12:32:10 AM9/19/17
to Angular and AngularJS discussion
Hi,
I'm trying to build an application that has the following requirements:
  • Cannot use cookies, so we're using a JWT token for authentication
  • Source files must be separated by module, with all but the login module source files requiring authentication at the server
So, we're using webpack for the build and creating chunk files, and using the loadChildren feature in Angular for lazy loading the modules.

Our problem is that we cannot find a way to send our JWT token to the server via a HTTP header when Angular loads the loadChildren modules.  I don't see anyway to extend/configure the http request to add headers (or alter in any way) the http request that retrieves and loads the loadChildren source files, similar to the way that you can extend the Angular Http class to modify options, headers, etc.

Is there anyway for us to send a 'Authorization' header with the request Angular internally makes to lazy load the loadChildren files?

Thanks,
Brian
Reply all
Reply to author
Forward
0 new messages