I want to login user with ajax,I create custom login user route
tcdev.login:
path: '/tclogin/{username}/{pass}'
defaults:
_controller: 'Drupal\tcdev\Controller\MYCenterController::login'
_title: 'Login call back'
requirements:
_permission: 'access content'
and in controller
namespace Drupal\tcdev\Controller;
use Drupal\Core\Controller\ControllerBase;
class MyCenterController extends ControllerBase{
public function login($username,$pass){
// do authentication process
return new Response('Hi ' . $username);
}
}
what is best solution for authentication user in controller?