Recent Topics

I need to deliver the Api token from the json response not the header



  • Hello, i'm working with a Nuxt.js project, i'm using Bagisto as backend and i need to get the Token from the JSON response not the header, when i log-in via API i get a "true" instead of the token.

    What do i need to do to display the token in the JSON response?

    capture Api.JPG



  • Hi,

    Do the following -

    1. Open 'app.php' file of config folder & add the below code in providers array

    Tymon\JWTAuth\Providers\LaravelServiceProvider::class,

    1. Run the following command from root of your project

    php artisan jwt:secret

    3: . Send token=true for login end point to get token
    (eg. http://localhost/191/bagisto/public/api/customer/login?token=true )

    Thanks



  • Thanks Rahul you saved me



  • I got many difficulties applying the Api in the front End even after your solution, there are some steps missing yet:

    1. You must register the middleware for auth.jwt

    Capture23.JPG

    1. There are other steps in between but the current version of Bagisto got it done until the middleware in the Api routes, so you can add the middleware like this

    Capture24.JPG

    and that way you can use your Bagisto api with Nuxt.js official Auth module, at least it works for me



  • I got token in my Login API. How to use this Api to Add product in wishlist or Cart or any Api of customer data and order?


Log in to reply