Skip to content

Commit

Permalink
prevent refreshing a token that is not able to be refreshed
Browse files Browse the repository at this point in the history
  • Loading branch information
fr0tt committed Oct 14, 2023
1 parent 08c9888 commit c81c9c3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/Http/Controllers/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Password;
use Illuminate\Support\Facades\Hash;
Expand Down Expand Up @@ -34,8 +35,11 @@ public function me(Request $request)
return response()->json(['data' => $request->user()]);
}

public function refresh()
public function refresh(Request $request)
{
if (!auth('api')->check()) {
return response()->json('', Response::HTTP_BAD_REQUEST);
}
$data = [
"token" => [
"access_token" => Auth::refresh(),
Expand Down

0 comments on commit c81c9c3

Please sign in to comment.