Bagisto Forum

    Bagisto

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

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

    Modules
    12
    14
    4066
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      carlosgarts last edited by

      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

      1 Reply Last reply Reply Quote 0
      • S
        sandeep last edited by

        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?

        H Y 2 Replies Last reply Reply Quote 0
        • W
          wearecoders last edited by

          Thank you so much. It is a great help from bagisto Forums. Thanks again to all.

          1 Reply Last reply Reply Quote 1
          • H
            haratmalli @sandeep last edited by

            @sandeep did u find the solution, how to send token to further interact with apis

            1 Reply Last reply Reply Quote 0
            • E
              eolykab last edited by

              Hi.

              Thanks this allows me to get the token. But however, I am getting a Cors issue. See the below image and please advise on how I can solve this. I am using VueJs in the front end.

              ![alt text](Screenshot from 2020-08-03 11.01.38.png image url)

              1 Reply Last reply Reply Quote 0
              • V
                Vaishali Agarwal last edited by

                @eolykab
                you may read this guide to fixup this issue https://medium.com/@dtkatz/3-ways-to-fix-the-cors-error-and-how-access-control-allow-origin-works-d97d55946d9

                1 Reply Last reply Reply Quote 0
                • Y
                  yomnademerdash @sandeep last edited by

                  @sandeep i have the same problem ! did you find a solution ?

                  1 Reply Last reply Reply Quote 0
                  • R
                    rndwiga254 last edited by

                    Heads up people!

                    After 6 hours of digging through the code base this line stood out:

                    $this->guard = request()->has('token') ? 'api' : 'customer';
                    

                    It means even if you have the header set correctly, your mobile application will still not authenticate. So, to solve this, what you need to do is add:

                    cartItem.put("token",sharedPref.getCustomerApiToken());
                    

                    On all objects that need to be authenticated. If stuck reach-out.

                    1 Reply Last reply Reply Quote 0
                    • S
                      simi61193 last edited by

                      How can i use token for adding product to cart.
                      I got token from login api. but when i am using this token in cart add it respond 500 error

                      1 Reply Last reply Reply Quote 0
                      • devansh-webkul
                        devansh-webkul last edited by

                        Hi @simi61193

                        May, I know the full request data and URI you are hitting.

                        1 Reply Last reply Reply Quote 1
                        • J
                          jignesh last edited by

                          Hello we are trying to use graphql api for admin authentication but we are facing 500 internal server error.

                          can you please assist is there anything we need to enable or install package for access.

                          thank you.

                          b5ebb5f3-ebbf-4c74-a71d-5d4d1c20456d-image.png

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post