api: refresh token

This commit is contained in:
saparatayev 2022-02-02 11:50:50 +05:00
parent c10ed056e8
commit bc0c203996
1 changed files with 9 additions and 1 deletions

View File

@ -3,6 +3,7 @@
use RainLab\User\Models\User as UserModel;
use RainLab\User\Models\Settings as UserSettings;
use Vdomah\JWTAuth\Models\Settings;
use Illuminate\Http\Request;
Route::group(['prefix' => 'api'], function() {
@ -57,7 +58,14 @@ Route::group(['prefix' => 'api'], function() {
if (Settings::get('is_refresh_disabled'))
App::abort(404, 'Page not found');
$token = Request::get('token');
$validation = \Validator::make($request->all(), [
'token' => 'required'
]);
if ($validation->fails()) {
return response()->json(['error' => $validation->errors()], 400);
}
$token = $request->get('token');
try {
// attempt to refresh the JWT