Closed Alexander-Fuchs closed 5 years ago
I guess you're importing HttpService
in your AuthenticationService
then?
If that's the cause, this is the root of your issue, as your are creating an import loop. It's not caught at build time as HttpService
creates new instance each time to allow changing interceptors dynamically.
To solve this, the simplest way is to create a new independant service to store your credentials (JWT token), and import this service in AuthenticationService
and JwtInterceptor
and remove any reference in your interceptor to AuthenticationService
if you plan to use HttpService
in it, to break the import loop.
@Alexander-Fuchs was @sinedied's answer useful to you?
I'm closing it since we have no feedback on this, feel free to comment if it's not solved yet.
I'm submitting a...
Current behavior
I am using HttpClient in AuthenticationService and created an JwtInterceptor. This JwtInterceptor is added to the HttpServer the same way as the ApiPrefixInterceptor. When importing the AuthenticationService in the JwtInterceptor it runs into an "Maximum call stack size exceeded". As debugging shows, the HttpService constructor is called infinitely -> which causes the "Maximum call stack size exceeded". Update: If i dont use your HttpService it is working... (adding the interceptors to the app.core providers)
Expected behavior
No "Maximum call stack size exceeded"?
Environment
Current ngx-rocket generator with bootstrap and authentication.