After add Cart it always return item_count 1and cart return null



  • When i call following url

    Get http://35.239.195.234/hemchhaya/public/api/checkout/cart

    its always return
    {
    "data": null
    }

    http://35.239.195.234/hemchhaya/public/api/checkout/cart/add/20
    param
    product_id:20
    quantity:1

    it always return
    item_count : 1



  • If you are using guests then make sure, you provide cookies. And if you are using a customer then make sure you provide a token with query string ?token=true.



  • but still give error. The error are following :

    {
    "message": "Argument 3 passed to Lcobucci\JWT\Signer\Hmac::doVerify() must be an instance of Lcobucci\JWT\Signer\Key, null given, called in C:\xampp\htdocs\hemchhaya\vendor\lcobucci\jwt\src\Signer\BaseSigner.php on line 44",
    "exception": "TypeError",
    "file": "C:\xampp\htdocs\hemchhaya\vendor\lcobucci\jwt\src\Signer\Hmac.php",
    "line": 29,
    "trace": [
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\lcobucci\jwt\src\Signer\BaseSigner.php",
    "line": 44,
    "function": "doVerify",
    "class": "Lcobucci\JWT\Signer\Hmac",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\lcobucci\jwt\src\Signature.php",
    "line": 49,
    "function": "verify",
    "class": "Lcobucci\JWT\Signer\BaseSigner",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\lcobucci\jwt\src\Token.php",
    "line": 202,
    "function": "verify",
    "class": "Lcobucci\JWT\Signature",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\tymon\jwt-auth\src\Providers\JWT\Lcobucci.php",
    "line": 136,
    "function": "verify",
    "class": "Lcobucci\JWT\Token",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\tymon\jwt-auth\src\Manager.php",
    "line": 101,
    "function": "decode",
    "class": "Tymon\JWTAuth\Providers\JWT\Lcobucci",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\tymon\jwt-auth\src\JWT.php",
    "line": 200,
    "function": "decode",
    "class": "Tymon\JWTAuth\Manager",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\tymon\jwt-auth\src\JWT.php",
    "line": 136,
    "function": "getPayload",
    "class": "Tymon\JWTAuth\JWT",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\tymon\jwt-auth\src\JWT.php",
    "line": 149,
    "function": "checkOrFail",
    "class": "Tymon\JWTAuth\JWT",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\tymon\jwt-auth\src\JWTGuard.php",
    "line": 79,
    "function": "check",
    "class": "Tymon\JWTAuth\JWT",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\packages\Webkul\API\Http\Controllers\Shop\CartController.php",
    "line": 81,
    "function": "user",
    "class": "Tymon\JWTAuth\JWTGuard",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\laravel\framework\src\Illuminate\Routing\Controller.php",
    "line": 54,
    "function": "get",
    "class": "Webkul\API\Http\Controllers\Shop\CartController",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php",
    "line": 45,
    "function": "callAction",
    "class": "Illuminate\Routing\Controller",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\laravel\framework\src\Illuminate\Routing\Route.php",
    "line": 239,
    "function": "dispatch",
    "class": "Illuminate\Routing\ControllerDispatcher",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\laravel\framework\src\Illuminate\Routing\Route.php",
    "line": 196,
    "function": "runController",
    "class": "Illuminate\Routing\Route",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\laravel\framework\src\Illuminate\Routing\Router.php",
    "line": 685,
    "function": "run",
    "class": "Illuminate\Routing\Route",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
    "line": 128,
    "function": "Illuminate\Routing\{closure}",
    "class": "Illuminate\Routing\Router",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\packages\Webkul\Shop\src\Http\Middleware\Currency.php",
    "line": 46,
    "function": "Illuminate\Pipeline\{closure}",
    "class": "Illuminate\Pipeline\Pipeline",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
    "line": 167,
    "function": "handle",
    "class": "Webkul\Shop\Http\Middleware\Currency",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\packages\Webkul\Shop\src\Http\Middleware\Theme.php",
    "line": 31,
    "function": "Illuminate\Pipeline\{closure}",
    "class": "Illuminate\Pipeline\Pipeline",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
    "line": 167,
    "function": "handle",
    "class": "Webkul\Shop\Http\Middleware\Theme",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\packages\Webkul\Shop\src\Http\Middleware\Locale.php",
    "line": 50,
    "function": "Illuminate\Pipeline\{closure}",
    "class": "Illuminate\Pipeline\Pipeline",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
    "line": 167,
    "function": "handle",
    "class": "Webkul\Shop\Http\Middleware\Locale",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
    "line": 103,
    "function": "Illuminate\Pipeline\{closure}",
    "class": "Illuminate\Pipeline\Pipeline",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\laravel\framework\src\Illuminate\Routing\Router.php",
    "line": 687,
    "function": "then",
    "class": "Illuminate\Pipeline\Pipeline",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\laravel\framework\src\Illuminate\Routing\Router.php",
    "line": 662,
    "function": "runRouteWithinStack",
    "class": "Illuminate\Routing\Router",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\laravel\framework\src\Illuminate\Routing\Router.php",
    "line": 628,
    "function": "runRoute",
    "class": "Illuminate\Routing\Router",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\laravel\framework\src\Illuminate\Routing\Router.php",
    "line": 617,
    "function": "dispatchToRoute",
    "class": "Illuminate\Routing\Router",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php",
    "line": 165,
    "function": "dispatch",
    "class": "Illuminate\Routing\Router",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
    "line": 128,
    "function": "Illuminate\Foundation\Http\{closure}",
    "class": "Illuminate\Foundation\Http\Kernel",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\barryvdh\laravel-debugbar\src\Middleware\InjectDebugbar.php",
    "line": 67,
    "function": "Illuminate\Pipeline\{closure}",
    "class": "Illuminate\Pipeline\Pipeline",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
    "line": 167,
    "function": "handle",
    "class": "Barryvdh\Debugbar\Middleware\InjectDebugbar",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\laravel\framework\src\Illuminate\Session\Middleware\StartSession.php",
    "line": 116,
    "function": "Illuminate\Pipeline\{closure}",
    "class": "Illuminate\Pipeline\Pipeline",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\laravel\framework\src\Illuminate\Session\Middleware\StartSession.php",
    "line": 62,
    "function": "handleStatefulRequest",
    "class": "Illuminate\Session\Middleware\StartSession",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
    "line": 167,
    "function": "handle",
    "class": "Illuminate\Session\Middleware\StartSession",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\laravel\framework\src\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse.php",
    "line": 37,
    "function": "Illuminate\Pipeline\{closure}",
    "class": "Illuminate\Pipeline\Pipeline",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
    "line": 167,
    "function": "handle",
    "class": "Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\laravel\framework\src\Illuminate\Cookie\Middleware\EncryptCookies.php",
    "line": 67,
    "function": "Illuminate\Pipeline\{closure}",
    "class": "Illuminate\Pipeline\Pipeline",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
    "line": 167,
    "function": "handle",
    "class": "Illuminate\Cookie\Middleware\EncryptCookies",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\packages\Webkul\Core\src\Http\Middleware\CheckForMaintenanceMode.php",
    "line": 117,
    "function": "Illuminate\Pipeline\{closure}",
    "class": "Illuminate\Pipeline\Pipeline",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
    "line": 167,
    "function": "handle",
    "class": "Webkul\Core\Http\Middleware\CheckForMaintenanceMode",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",
    "line": 103,
    "function": "Illuminate\Pipeline\{closure}",
    "class": "Illuminate\Pipeline\Pipeline",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php",
    "line": 140,
    "function": "then",
    "class": "Illuminate\Pipeline\Pipeline",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php",
    "line": 109,
    "function": "sendRequestThroughRouter",
    "class": "Illuminate\Foundation\Http\Kernel",
    "type": "->"
    },
    {
    "file": "C:\xampp\htdocs\hemchhaya\public\index.php",
    "line": 74,
    "function": "handle",
    "class": "Illuminate\Foundation\Http\Kernel",
    "type": "->"
    }
    ]
    }



  • @sudipdig,

    • Run php artisan jwt:secret.
    • Run php artisan optimize.
    • Then try again with fresh token.

Log in to reply