893 questions
2
votes
1
answer
131
views
Does the httpResource have an HttpContext?
httpResource got released as an experimental feature in Angular 19.2. The httpResource uses the HttpClient under the hood. So I was hoping, I would be able to pass all the options I could pass to the ...
1
vote
1
answer
53
views
Functional style interceptors - How to provide them with dependencies
Imagine the situation where you provide any lib to client. Simple scenario, spinner interceptor which needs spinner service.
In old way it was possible to:
providers: [
{
provide: ...
1
vote
1
answer
79
views
Angular request duplicate if error is throw
I have a weird behavior with my requests. If the request throw an error, I automatically get a second one launched
Here is an example of my request :
this.http.post(environment['url'] + '/ws/verifier/...
0
votes
0
answers
66
views
Angular Interceptor repeating every request 3 times
I have an interceptor for refreshing an access token, when it doesn't refresh, everything's all good, but when it does, the unfortunate request that happened to pass through it when it decided to ...
1
vote
1
answer
46
views
Angular 17: What use to to fetch data at the app start moment?
there is an issue.
I have Angular 17 app.
There is a need to get a user data by http request as to keep it in localStorage and use everywhere.
The request should be send once only and as earlier as ...
0
votes
1
answer
101
views
Calling api request inside an interceptor for jwt refresh token going to an infinite loop
I am trying to implement the the refresh jwt token mechanism in an interceptor.
I am following the accepted answer way in this post
Angular - Waiting for refresh token function to finish before ...
1
vote
1
answer
226
views
How to test an Angular interceptor with a retry strategy?
This is a simplified version of my Angular 18 error interceptor. It will retry requests that produced an error to make sure it was not a fluke (please don't ask!). This works, however I am running ...
0
votes
1
answer
42
views
Angular Interceptor - retrieve Graphql query or mutation name
Good morning everyone,
I would need your help to retrieve the query or mutation name within the interceptor which is working fine.
import { HttpContextToken, HttpInterceptorFn } from '@angular/common/...
2
votes
1
answer
111
views
HttpContextToken always false while using HttpInterceptorFn
I am implementing a loading spinner that runs for all my http requests via an HttpInterceptorFn using this blog post as a guide: https://blog.angular-university.io/angular-loading-indicator/
loading....
1
vote
2
answers
71
views
Using fresh cookies from catch Error in HttpIntercopterFn
I have created an interceptor to ensure that every request sends HttpOnly JWT/refresh tokens. I am attempting to refresh my short-lived JWT by catching a 401 error and asking the server for a refresh. ...
1
vote
0
answers
200
views
Angular 17 Interceptor Not Adding Bearer Token on Initial Login Request
I'm working on an Angular 17 application where I'm trying to add an Authorization Bearer token to the request headers upon login. However, I'm facing an issue where the HttpInterceptor retrieves null ...
1
vote
1
answer
159
views
Angular 18.0.5 not seeing the interceptor and not working
I believe with standalone component and HttpInterceptor has a bug!
export const appConfig: ApplicationConfig = {
providers: [
// provideHttpClient(withInterceptorsFromDi()),
// { provide: ...
0
votes
2
answers
65
views
Angular login and http-interceptor - runtime problem
I use this function to login:
login() {
this.authService.login(this.ngForm.value).subscribe({
next: (response) => {
const loginData = response;
this.user = loginData.user;
this....
1
vote
5
answers
7k
views
HttpInterceptors and Dependency Injection Angular 18
I'm setting up a JWT interceptor in Angular 18.. I had this set up in Angular 8, although that was a completely different setup using a class which inherits HttpInterceptor. here I am using function ...
1
vote
2
answers
1k
views
How use async function in angular 17 function based Http Interceptor
I have an interceptor that adds the access token to every request. The only problem is, the only way I can get this access token is by using a function that returns a Promise:
async getToken(): ...
2
votes
1
answer
642
views
Type 'unknown' is not assignable to type 'HttpEvent<any>' - Trying to create HTTP interceptor in Angular app
I have been trying to create a loading spinner in my Angular application.
I found an interesting tutorial here.
It was all going pretty well, until the final step, when I need to actually create the ...
0
votes
1
answer
399
views
How to use the NGRX selectors inside an interceptor without deprecated commands
In my app I created by using Angular 17 I have a very simple interceptor:
import { HttpInterceptorFn } from '@angular/common/http';
import { HttpBodyModel } from "../models/http-body.model";
...
1
vote
1
answer
918
views
Implementation of interceptors in angular 17
how do I inject an interceptor to an application generated as a modular app in angular 17? I mean the one generated with the --standalone argument?
I tried injecting it as [provideHttpClient(...
1
vote
1
answer
173
views
Why does this interceptor only trigger on the Sent-Event, but not the actual response?
I'm receiving some multipart/mixed content from a server that contains some JSON as well as bytes and need to parse it into an object in Angular.
This is how I send out my request:
public sendRequest(...
0
votes
1
answer
157
views
ngx-translate not working with interceptor in Ionic Capacitor app
I'm facing an issue with ngx-translate while integrating it with an interceptor in my Ionic Capacitor application. When attempting to access the translate service within the interceptor, I facing the ...
0
votes
1
answer
848
views
Angular error interceptor - Multiple 401 responses
I'm currently working on implementing a refresh token mechanism in my Angular frontend. When my backend returns a 401 error, my error interceptor handles it. However, I'm facing an issue: when my ...
3
votes
2
answers
5k
views
How to use functional interceptor for refreshing token in Angular 17
I was using the following class-based interceptor to refresh user token:
@Injectable()
export class AuthInterceptor implements HttpInterceptor {
constructor(private inject: Injector) {}
...
0
votes
0
answers
42
views
Interceptor event always throws error after login to application
Interceptor event always throws error and error block geting exicuting.
We are upgrading our existing angular10 application to Angular 15. After upgradation we are facing issue whicle login to ...
1
vote
2
answers
1k
views
Angular Http Interceptor - Modifying headers causes CORS
I have defined an http interceptor. Inside the interceptor I have the following code:
let newReq = req.clone({
withCredentials: true,
responseType: 'json'
});
Now I need to modify all requests ...
0
votes
0
answers
126
views
Why do I need a subscribe in my interceptor function?
All of the examples that I'm following (https://github.com/bartosz-io/jwt-auth-angular), do not have a subscribe in the code, but it is the only way I can get my interceptor function to work. Notice ...