you can just use JSON login for login using API,
https://symfony.com/doc/current/security.html#json-login