Recently I have ungraded my laravel project from 5.1 to 6. I upgraded the project like this->
While doing so i'm facing this problem. I used separate controller and route for authenticating a user. while authenticating the user the login session is not persist, so it is redirecting me back to login page again. I've checked that my credential for login is correct and Auth::attempt
also return true. But when i redirecting it to my desire route, that where it sent me to login page.
public function signInAction(Request $request)
if (Auth::attempt($loginCredentials)) {
$logonId = $secUserLogon[0]->logon_id;
$request->session()->put('sessLogonId', $logonId); // this session data in not available later on
return redirect()->intended(route('home::onlineInfo'));
}
}
I found a workaround, which seems not right. I have passed true as 2nd parameter in Auth::attempt
which is letting me logged in the user. But if i put anything in session, its not persist either, and if i implement remember me, it will not work if user pass false. Can anyone help me out with this one?
Have you tried using the global session()
helper? This may be more reliable. https://laravel.com/docs/6.x/session#storing-data
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.