1

Currently I am developing Symfony application where I have multiple login form. For the login form I created the firewall and also created custom authenticator. New created custom authenticator added into the services.yaml file as well.

enter image description here

Authenticator working perfectly when added to the main firewall but it is not working with the oauth_login firewall.

New authenticator file is manually created.

When ever I try to login with oauth_login form, I am not able to login and also OLoginFormAuthenticator is not called.

Edit:

Following changes worked for me

enter image description here

shukla147
  • 74
  • 1
  • 8
  • In the future please refrain from using images for config. Just use a code block. Using both form_login and an authenticator for a given firewall is very unusual. One or the other but not both. If you have not already, verify that your Authenticator::supports method is working as expected. The default implementation does not always work properly. Firewalls can be tricky. Sometimes it helps to start with a new project and minimal configuration. – Cerad Nov 23 '22 at 12:50
  • Thank you for suggestion, I resolved the issue by disabling few of the setting in the oauth_login firewall. TBH firewall is tricky with custom authenticator. I am editing the question with options that worked for me. – shukla147 Nov 24 '22 at 09:30

1 Answers1

1

A few approaches and ideas:

Rename custom_authenticator

Try to name the property custom_authenticators: (with an trailing s) See How to Write a Custom Authenticator for more information.


Check entry_point target

Also your entry_point could be wrong! Does your Authenticator implements AuthenticationEntryPointInterface? You maybe want a separate class for this.

See The Entry Point for more information.


Show all possible configurations of security.yaml

Type this in your terminal to see all possible configurations of security.yaml

php bin/console config:dump-reference security
Jonathan
  • 1,955
  • 5
  • 30
  • 50
  • It is a bit strange that dump-reference shows `custom_authenticators` but not `custom_authenticator` which can be used when you only have one authenticator. Never ran across something like that before. – Cerad Nov 23 '22 at 12:59
  • Thanks for suggestions Jonathan, My issue has bee resolved by making changes in security.yaml file. Removed few parameters and it worked like charm. – shukla147 Nov 24 '22 at 09:38
  • Glad it helped. Can you point out what exact parameters you removed? It may help others with similar problems in the future. If my answer helped you solving the problem, I'll be happy to have it marked as solution. Good day mate! – Jonathan Nov 24 '22 at 10:14
  • I edited my question and added the snippet image of my solution. – shukla147 Nov 24 '22 at 12:51
  • I am curious, do you know which property caused the error? Was it multiple properties? Or just the `entry_point`? – Jonathan Nov 24 '22 at 13:34