From 479701539e2f296566bc287a58e64e5bcd50c1bc Mon Sep 17 00:00:00 2001 From: vd1992 <40485260+vd1992@users.noreply.github.com> Date: Tue, 19 Dec 2023 12:57:34 -0700 Subject: [PATCH] adjust throwing exception --- api/app/Http/Controllers/AuthController.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/api/app/Http/Controllers/AuthController.php b/api/app/Http/Controllers/AuthController.php index eba8f7f7c3b..5fcf8215cff 100644 --- a/api/app/Http/Controllers/AuthController.php +++ b/api/app/Http/Controllers/AuthController.php @@ -5,6 +5,7 @@ use App\Services\OpenIdBearerTokenService; use Illuminate\Http\Request; use Illuminate\Support\Facades\Http; +use Illuminate\Support\Facades\Log; use Illuminate\Support\Str; use InvalidArgumentException; use Lcobucci\JWT\Configuration; @@ -80,15 +81,14 @@ public function authCallback(Request $request) // pull token out of the response as json -> lcobucci parser, no key verification is being done here however $idToken = $response->json('id_token'); - $config = $this->fastSigner; + if (! ($idToken && is_string($idToken))) { + Log::debug((string) $response->body()); + throw new InvalidArgumentException('id token is a '.gettype($idToken)); + } + $config = $this->fastSigner; assert($config instanceof Configuration); - throw_unless( - $idToken && is_string($idToken), - new InvalidArgumentException('id token is a '.gettype($idToken)) - ); - $token = $config->parser()->parse($idToken); assert($token instanceof UnencryptedToken);