So I have removed all laravel 5.5 oringinal auth stuff so my Auth\LoginController now looks like this:
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Tymon\JWTAuth\Facades\JWTAuth;
use Tymon\JWTAuth\Exceptions\JWTException;
class LoginController extends Controller
{
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
*/
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest')->except('logout');
}
public function authenticate(Request $request)
{
// grab credentials from the request
$credentials = $request->only('email', 'password');
return response()->json( $credentials );
try {
// attempt to verify the credentials and create a token for the user
if (! $token = JWTAuth::attempt($credentials)) {
return response()->json(['error' => 'invalid_credentials'], 401);
}
} catch (JWTException $e) {
// something went wrong whilst attempting to encode the token
return response()->json(['error' => 'could_not_create_token'], 500);
}
// all good so return the token
return response()->json(compact('token'));
}
}
Route in Web.php
Route::post('/authenticate', 'Auth\LoginController@authenticate');
So I have removed all laravel 5.5 oringinal auth stuff so my Auth\LoginController now looks like this:
Route in Web.php
Route::post('/authenticate', 'Auth\LoginController@authenticate');
In my login.vue file:
If I try to login I get this error:
I am new to Token Auth so not sure whats going on. The error seems pretty vague