From 4b9e568985ffe08207b923ce3928adb19b47197e Mon Sep 17 00:00:00 2001 From: Hritikkk9 Date: Tue, 16 Jul 2024 18:48:00 +0530 Subject: [PATCH] customer jwt updated --- app/Http/Middleware/CustomerJwtMiddleware.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/Http/Middleware/CustomerJwtMiddleware.php b/app/Http/Middleware/CustomerJwtMiddleware.php index 9217fd4..e928b32 100644 --- a/app/Http/Middleware/CustomerJwtMiddleware.php +++ b/app/Http/Middleware/CustomerJwtMiddleware.php @@ -9,6 +9,7 @@ use Illuminate\Support\Facades\Session; use Tymon\JWTAuth\Exceptions\JWTException; use Illuminate\Http\Request; use Symfony\Component\HttpFoundation\Response; +use Illuminate\Support\Facades\Log; class CustomerJwtMiddleware { @@ -32,9 +33,14 @@ class CustomerJwtMiddleware $user = JWTAuth::setToken($token)->authenticate(); // Check if authentication was successful and user type is correct - // if (!$user || $user->principal_type_xid !== 3) { - // return response()->json(['status' => 'error', 'status_code' => 401, 'message' => 'Unauthorized access'], 401); - // } + Log::info("Customer jwt"); + Log::info($user); + + if (!$user || $user->principal_type_xid !== 3) { + return response()->json(['status' => 'error', 'status_code' => 401, 'message' => 'Unauthorized access'], 401); + } + Log::info("Customer jwt"); + Log::info($user); Session::flash('vendorToken', $token); } catch (JWTException $e) {