Unable to log User into Symfony with custom Authenticator
ikerib opened this issue · 3 comments
I readed the docs and it says "But often, you will want to actually authenticate that user: log them into your system. In that case, instead of putting all of the logic in connectCheckAction() as shown above, you'll leave that blank and create an authenticator which will hold similar logic."
So I deleted all my code and leave it empty but I got this error:
The controller must return a "Symfony\Component\HttpFoundation\Response" object but it returned null. Did you forget to add a return statement somewhere in your controller?
this is my security.yaml
this is my knp_oauth2_client.yaml
this is my SecurityController.php
and this is my OauthAuthenticator.php
I don¡t know why if check code is empty is not going into authenticate method.
Any help or clue?
Hi!
tbh, it looks good to me. Your Authenticator should handle all requests to the oauth connect route. Then, with should fail or be successful, and in both cases, in your Authenticator, you’re redirecting. I can’t see how the request would get to your controller. It must be something minor…
Thanks... I asked because I don't know what else to check...2 days with this... maybe I need to change to another thing and come back with this next week.
I finally found the problem. The thing was that I have 2 firewalls but the routes where the oAuth is managed were not inside the pattern of the oAuth firewall.
Now it does process the authenticate completely but the user is not logged in (although it doesn't fail) for some reason. Let's see...