diff --git a/app/Http/Controllers/AuthController.php b/app/Http/Controllers/AuthController.php index ff0e8ff..4b16026 100644 --- a/app/Http/Controllers/AuthController.php +++ b/app/Http/Controllers/AuthController.php @@ -7,6 +7,7 @@ use Illuminate\Support\Facades\Session; use Inertia\Inertia; use Laravel\Socialite\Facades\Socialite; +use Laravel\Socialite\Two\InvalidStateException; class AuthController extends Controller { @@ -27,7 +28,11 @@ public function login() public function loginCallback() { - $user = Socialite::driver('identity')->user(); + try { + $user = Socialite::driver('identity')->user(); + } catch (InvalidStateException $e) { + return redirect()->route('auth.login'); + } if (!in_array('54ZYODX15G2K1M76', $user->user['groups'], true)) { return redirect()->route('auth.login')->with('error', 'You are not allowed to access this application'); }