[Bug]: AuthInterceptor has wrong matchingConfig when more than one config have the same secureRoutes
I am using Ad B2C Authentication and I have 2 configurations: SignUpSignIn and SignUp. Both are registered with AuthModule.forRoot, but they share almost the same parameters, especially regarding secureRoutes. I checked the code, and in AuthInterceptor you do:
const { matchingConfig, matchingRoute } = deps.closestMatchingRouteService.getConfigIdForClosestMatchingRoute(req.url, allConfigurations);
Which always give the first config. So when I am logged with the second one, the first config is returned, and then when you do this:
const token = deps.authStateService.getAccessToken(matchingConfig);
I get a null token. I very easy fix would be to change getConfigIdForClosestMatchingRoute so that it returns a ClosestMatchingRouteResult[] instead of stopping on the first one, then loop over the matching configs and try to getAccessToken until one is found and then use it.
It seems like a very easy fix, unless I forgot something! Should I be making a PR ?
Version
15.0.3
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
No response
Steps to reproduce the behavior
No response
A clear and concise description of what you expected to happen.
Additional context
No response
Started reading issues and this bug was mentionned here: #1566
But I think there should be an official fix.
I have the same problem!!
Same problem here