Symfony 4.4 Authenticate using API

My company keeps users in a MySQL database and has an API set up to see if the user/pass exists and sends back an XML response with the elements:

status (whether or not the email has been verified)
message (something went wrong like “user not found”)

I used bin/console to generate my login code and it created a UserProvider class that I don’t believe I can use, but requires it in LoginFormAuthenticator::getUser().

All I really think I need to do is build my User object from the API response and assign the appropriate role to my User class for access, or show errors for what ever might have gone wrong based on the response from the API.

I added User $user to my __construct() method in LoginFormAuthenticator so I have access to my User class but that somehow doesn’t feel right.

Do I HAVE to use the UserProvider?

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *