-
Notifications
You must be signed in to change notification settings - Fork 477
Closed
Description
I am facing a weird issue where the JWT interceptor stops sending the authorization header after the browser is sitting for a while and then if an API request is sent. I am unable to replicate this at will and thats why i dont have reproduction steps. I just see these being reported in the server logs intermittently.
I am on the latest available version 5.1.2 of JWT library
Angular 14.2.8
It happens from both MacOS and Windows on Chrome, Safari etc
It works fine for awhile and then same API calls start missing authorization header
This is the code snippet we have:
export function JwtTokenGetter(): string {
if ( localStorage ) {
return localStorage.getItem('token');
} else {
return window.localStorage.getItem('token');
}
}
@NgModule({
imports: [
JwtModule.forRoot({
config: {
tokenGetter : JwtTokenGetter,
allowedDomains : allowedDomains,
disallowedRoutes: [new RegExp(/.*skipInterceptors=true.*/im)],
},
}),
[...]
],
providers: [
JwtInterceptor, // Providing JwtInterceptor allow to inject JwtInterceptor manually into RefreshTokenInterceptor
{
provide : HTTP_INTERCEPTORS,
useExisting: JwtInterceptor,
multi : true,
},
{
provide : HTTP_INTERCEPTORS,
useClass: RefreshTokenInterceptor,
multi : true,
},
[...]
]
})
Any ideas how to debug this?
Metadata
Metadata
Assignees
Labels
No labels