customer jwt updated

This commit is contained in:
Hritikkk9
2024-07-16 18:48:00 +05:30
parent 333089cea1
commit 4b9e568985

View File

@@ -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) {