Yup been stuck on this issue for a day now.
The following did nothing for me: https://github.com/laravel/framework/issues/13000
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi guys, i have an issue with the login function. I need to authenticate my users with a http header. It contains an id but no password so i'm using Auth::login() function. The user is logged in, but right after he's logged out. See my code here :
public function postLoginGassi() {
try {
$headers = apache_request_headers();
$user = User::where('CUID', $headers['sm_universalid'])->first();
//dd($headers);
$var = Auth::loginUsingId($user['id']);
Auth::login($var);
} catch (Exception $ex) {
return $headers;
}
if (Auth::check()) {
switch (Auth::user()->role->name):
case 'Pilote':
return View::make('pilote.homePilote');
case 'Opoci':
return View::make('opoci.homeOpoci');
case 'Soutient metier':
return View::make('SM.homeSM');
case 'Responsable d\'equipe':
return View::make('re.homeRE');
endswitch;
} else {
return "fail";
}
}
Do you know why ?
Thanks,
I found a solution, by setting the password of my users equal to their id(hashed), i can use the Auth::Attempt() method avoiding the session's problems.
public function postLoginGassi() { try { $headers = apache_request_headers(); if (Auth::attempt(['CUID' => $headers['sm_universalid'], 'password' => $headers['sm_universalid']])) { return Redirect::to('/'); } }
Please or to participate in this conversation.