1
Trying out this 'new' Laravel Breeze API package, trying to combine it with Sanctum. Upon editing the code a bit I stumbled upon some weird error that I do not understand. When I try to authenticate with postman
public function store(LoginRequest $request)
{
if($request->authenticate())
{
$token = $request->user()->createToken('AccessToken')->plainTextToken;
return response(['AcessToken' => $token], 200);
}
else{
return response(['Status' => 'Unsuccesful login']);
}
}
This is the AuthenticatedSessionController.php
I tried to edit it to return an Access token if the login is successfull, and to send a 'Status' response if the login has failed, instead what I got is, upon sending valid login credentials, I get the ['Status' => 'Unsuccesful login']
, and if the Login credentials are not valid, I get redirected to the root page "/", any ideas?
0 comments:
Post a Comment
Thanks