How to create a manual login from a controller method in symphony old version

115 views Asked by At

I am pretty new to symphony. I am trying to build a REST API for qdPm(open source project management tool). I want to create a custom login,authenticate a user manually,create a token and use it for all the rest API calls

I am working on oldest symphony version i have disabled security(login) for one method "executeAuthenticateUser()" inside which i want to write a manual login as below

public function executeAuthenticateUser() {
    $form = new LoginForm();
    $login['_csrf_token']=$form->getCSRFToken('login');
    $login['email']="[email protected]";
    $login['password']="123456";

    $islogin= login::index($login);
    if ($islogin) {
       $token= some hash ...//to use this token for the upcoming api calls
    }

}

I am getting a csrf token required error upon calling existing login method. Is this a correct approach to create REST api for oldest symphony version. I need suggestions or corrections for what i am trying to work out.

Thanks in advance

0

There are 0 answers