Rename auth guard
This commit is contained in:
parent
d2ad6107d1
commit
1ae0329083
@ -254,9 +254,9 @@ class AuthController extends Controller
|
||||
return view('auth.verify');
|
||||
}
|
||||
|
||||
public function apiLogin(Request $request)
|
||||
public function jwtLogin(Request $request)
|
||||
{
|
||||
$token = Auth::guard('api')->attempt([
|
||||
$token = Auth::guard('jwt')->attempt([
|
||||
'email' => $request->email,
|
||||
'password' => $request->password
|
||||
]);
|
||||
@ -264,14 +264,14 @@ class AuthController extends Controller
|
||||
return json(compact('token'));
|
||||
}
|
||||
|
||||
public function apiLogout()
|
||||
public function jwtLogout()
|
||||
{
|
||||
Auth::guard('api')->logout();
|
||||
Auth::guard('jwt')->logout();
|
||||
return response('', 204);
|
||||
}
|
||||
|
||||
public function apiRefresh()
|
||||
public function jwtRefresh()
|
||||
{
|
||||
return json(['token' => Auth::guard('api')->refresh()]);
|
||||
return json(['token' => Auth::guard('jwt')->refresh()]);
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ return [
|
||||
'provider' => 'users',
|
||||
],
|
||||
|
||||
'api' => [
|
||||
'jwt' => [
|
||||
'driver' => 'jwt',
|
||||
'provider' => 'users',
|
||||
],
|
||||
|
@ -1,12 +1,12 @@
|
||||
<?php
|
||||
|
||||
Route::prefix('auth')->group(function ($route) {
|
||||
$route->post('login', 'AuthController@apiLogin');
|
||||
$route->post('logout', 'AuthController@apiLogout')->middleware('auth.jwt');
|
||||
$route->post('refresh', 'AuthController@apiRefresh')->middleware('auth.jwt');
|
||||
$route->post('login', 'AuthController@jwtLogin');
|
||||
$route->post('logout', 'AuthController@jwtLogout')->middleware('auth:jwt');
|
||||
$route->post('refresh', 'AuthController@jwtRefresh')->middleware('auth:jwt');
|
||||
});
|
||||
|
||||
Route::prefix('user')->middleware('auth:api')->group(function ($route) {
|
||||
Route::prefix('user')->middleware('auth:jwt')->group(function ($route) {
|
||||
$route->put('sign', 'UserController@sign');
|
||||
|
||||
$route->get('players', 'PlayerController@listAll');
|
||||
|
Loading…
Reference in New Issue
Block a user