I am working with Laravel own authentication with CSRF tokens...
in my controller
public function __construct()
{
$this->middleware('auth')->except('login');
}
public function authenticate(Request $request)
{
$credentials = $request->only('email', 'password');
if ($token = Auth::attempt($credentials))
{
// $request->session()->regenerate();
// return response()->json(compact('token'));
return redirect()->intended('/home');
}
and routeRoute::post('/authenticate', 'AuthController@authenticate');
It is logging me successfully and sending to home page with csrf token
but I can't get the token in authenticate method. I want to use it to authenticate REST APIs... I don't want to use JWT or other Auth methods as I want REST APIs and other UI pages (blade) in same project...