Skip to content

Instantly share code, notes, and snippets.

View juneodev's full-sized avatar
🏝️
Working and Traveling

CUNEO Jérémie juneodev

🏝️
Working and Traveling
  • Juneo.dev | JKJ-DEV
  • Sydney, Australia
  • 00:10 (UTC +10:00)
View GitHub Profile
@azhararmar
azhararmar / Symfony - Manual User Authentication
Last active June 21, 2024 08:44
Manually Authenticate User In Symfony
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
// Manually authenticate user in controller
$token = new UsernamePasswordToken($user, null, 'main', $user->getRoles());
$this->get('security.token_storage')->setToken($token);
$this->get('session')->set('_security_main', serialize($token));