HttpInterceptor not working on 2.0.0
See original GitHub issueBug Report or Feature Request (mark with an x
)
- [X] bug report -> please search for issues before submitting
Versions.
@2.0.0 Angular 5.2
Repro steps.
- Make Post to keycloak node
- Inspect network calls in Chrome
- Note missing Authorization header + bearer token
import { BrowserModule } from '@angular/platform-browser';
import {APP_INITIALIZER, NgModule} from '@angular/core';
import { AppComponent } from './app.component';
import { TreasureComponent } from './treasure/treasure.component';
import { LandingComponent } from './landing/landing.component';
import {appRoutes} from './app.routes';
import {HttpClientModule} from '@angular/common/http';
import {KeycloakAngularModule, KeycloakService} from 'keycloak-angular';
import {treasureInit} from './treasure-auth/treasure.authorization.initializer';
import {TreasureAuthorizationGuard} from './treasure-auth/treasure.authorization.guard';
@NgModule({
declarations: [
AppComponent,
TreasureComponent,
LandingComponent
],
imports: [
appRoutes,
BrowserModule,
HttpClientModule,
KeycloakAngularModule
],
providers: [
TreasureAuthorizationGuard,
{
provide: APP_INITIALIZER,
useFactory: treasureInit,
multi: true,
deps: [KeycloakService]
}
], bootstrap: [AppComponent]
})
export class AppModule { }
The AuthGuard works as expected, but the HttpInterceptors do not append the bearer token.
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Interceptor not intercepting http requests (Angular 6)
Check your module & sub-module files, If you have imported the interceptor in a sub-module, then move it to the root module and...
Read more >Angular HttpInterceptor not firing on nested Observables-rx.js
Coding example for the question Angular HttpInterceptor not firing on nested ... The problem was fixed after removing the duplicate import.
Read more >ng-http-interceptor - npm
Description: Gets http RequestOptions from data array. If no options found and alwaysOriginal = false - returns new RequestOptions but does NOT ......
Read more >Angular: When HttpInterceptor doesn't work with lazy loaded ...
Abou Kone dives into a specific case when using an app wide HttpInterceptor does not work with lazy loaded features.
Read more >http_interceptor | Dart Package - Pub.dev
codingale.devNull safety• Latest: 1.0.2 / Prerelease: 2.0.0-beta.6 ... Retrying requests when an error occurs or when the response does not match the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
New versions release, including this update suggested and coded by @Mihai-B! @Mihai-B, thanks for your contribution to this project! @rightisleft thanks for reporting the issues!
I can confirm the same issue with the following stack: angular: 6.0.0 keycloak: 3.4.3 keycloak-angular: 3.0.0
I agree with @Mihai-B that losing the double negative would be an improvement.