you can use guard('api') or guard('users') method, since you have multiple guards
$credentials = request(['email', 'password']); if (!$token = auth()->guard('api')->attempt($credentials)) { return response()->json(['error' => 'Unauthorized'], 401); } return $token;