Hello everyone,
I've set up an authentication system with JWT and refresh token in an Angular application + Symfony API. However, I have a specific problem on the home page of my site, which does not require a connection (URL: https://matchLove.com).
Problem
On this page, a request is automatically made to the /api/me endpoint to check the user's connection status. However, as the user is not supposed to be authenticated on this page, the API returns a 401 error, which triggers the refresh token mechanism. This creates an infinite loop of attempts to refresh the token and blocks the rest of the page from loading.
Question
How could I configure my HTTP interceptor in Angular to :
Ignore the login check (request to /api/me) only on the home page,
Prevent the refresh token from being triggered in the event of a 401 only on this page?
Here is my current interceptor to handle 401 errors and refresh the token: