Hello im using web.php for the first time and initially i was making api endpoints and had installed and used jwt but then the client said he wants to do everything with laravle view and backend. So now i modified my AuthConrtoller ``` public function login(LoginRequest $request)
{
// Validation des données de la requête
$request->validate([
'email' => 'required|email',
'password' => 'required',
]);
$user = User::where('email', $request->email)->first();
// Chercher l'utilisateur par email
if ($user && app(Sha512Hasher::class)->check($request->password, $user->password)) {
Auth::login($user);
$request->session()->regenerate();
return redirect()->route('home')->with('success', 'Vous etes connecte');
// Authentification réussie
// $token = JWTAuth::fromUser($user);
// return response()->json([
// 'ok' => true,
// 'data' => UserResource::make($user),
// 'message'=> 'User logged in successfully',
// 'authorisation' => [
// 'token' => $token,
// 'type' => 'bearer',
// ]
// ]);
}
return back()->withErrors([
'email' => 'Les informations d\'identification fournies ne correspondent pas à nos enregistrements.',
])->withInput(); ``` and in my web.php i have this route ``` Route::get('/home', function () {
return view('components.homepage');
}); ``` but when i try to test login with postman i just receive a token with a 200 status meanwhile on the browser the page just reloads whether im putting the right or wrong credentials. I used csrf in the login form (i dont know too much about sessions) i dont really get the behavior. Chatgpt said something about middlewares but i've never used them and couldnt find the folder Middleware. Also i dont know if the fact that i had used jwt and made some configuration so it can be used could be causing the issue although i doubt since it's wokring with api. I'm using laravel 11. Feel free to ask any questions or more clarifications