JWTRefreshTokenBundle: Symfony 5.4 error AbstractGuardAuthenticator
Since Symfony 5.4, I have an error with the bundle.
Attempted to load class "AbstractGuardAuthenticator" from namespace "Symfony\Component\Security\Guard".
Did you forget a "use" statement for another namespace?
class RefreshTokenAuthenticator extends AbstractGuardAuthenticator
Could you help me to update the bundle ?
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 2
- Comments: 28 (13 by maintainers)
Without
controller:getting this error:Unable to find the controller for path "/api/token/refresh". The route is wrongly configured.You shouldn’t need it, https://github.com/markitosgv/JWTRefreshTokenBundle#define-the-refresh-token-route is pretty much the exact same thing I’m saying here with removing the controller key. https://github.com/markitosgv/JWTRefreshTokenBundle/issues/255#issuecomment-931211151 is the only other time I’ve seen that one referenced and there wasn’t really a “fix” shared beyond just rebuilding the route configuration.
Remove the
controller: gesdinet.jwtrefreshtoken::refreshconfig from the route. That line is only required for folks using Symfony 4.4 applications and will break a Symfony 6 application because the Security-Guard component is not supported on Symfony 6.The 1.1 release should fix this.
Remove the
controller:line from the route definition, it’s not needed with the newer authenticator.Sorry for my security.yaml😅 I hope I was able to help you solve you problem!🤜🏼🤛🏼
@blosky01 Thank you (it’s difficult to read your security.yaml ^^). I think it works, when I make a
POSTrequest to/api/token/refresh, the results contains atokenandrefresh_token?security.yaml:
routes.yaml:
If you’re getting an error about the
Symfony\Component\Security\Guard\AbstractGuardAuthenticatorclass missing, then something’s still trying to use it (maybe not this bundle specifically but somewhere in your app). Try to get a full stack trace for the error to figure out what’s calling it, that will help greatly in finding the source of the problem.For this bundle’s CI,
symfony/security-guardis explicitly removed before running the tests in the Symfony 6 environment. So there is a bit of a sanity check here with the tests to make sure that nothing’s trying to use the Security-Guard component in an unsupported environment.