Bagisto Forum

    Bagisto

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

    Getting User Data based on token in Cart Checkout API

    General Discussion
    2
    11
    937
    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.
    • S
      sanjay last edited by

      I'm using Bagisto API and i want user cart items data based on user token which defined in API but i didn't get customer data using token, please help me.!

      Thanks!!
      Sanjay P

      1 Reply Last reply Reply Quote 0
      • shubhwebkul
        shubhwebkul last edited by

        Hello there,

        have you tried this endpoint ?

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

          Yes i have used that endpoints..
          can you explain me about below code to get user data using below code?

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

          I have tried pass token but not getting customer data as well.

          1 Reply Last reply Reply Quote 0
          • shubhwebkul
            shubhwebkul last edited by shubhwebkul

            Basically with this we are setting middleware in our application either api middleware or customer.

            If you are sending token then it must be using api middleware

            Let me know if you have any further query.
            Thanks!

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

              Yes, that i understood but how can i get user data i have passed token and checked i didn't get any data for user for that token, and not create object for user.

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

                I mean is anything i need to pass for that ya only need to pass token?

                1 Reply Last reply Reply Quote 0
                • shubhwebkul
                  shubhwebkul last edited by

                  You only need to pass token in that API. have you tried fetching user as used here

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

                    Yes I checked that also but $customer is blank

                    $customer = auth($this->guard)->user();
                    
                    1 Reply Last reply Reply Quote 0
                    • shubhwebkul
                      shubhwebkul last edited by

                      Sanjay,

                      are you getting customer details with the help of auth('customer')->user(); ?

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

                        No, not getting customer details using that.

                        1 Reply Last reply Reply Quote 0
                        • shubhwebkul
                          shubhwebkul last edited by

                          Hello there,

                          As I am checking I am getting customer email in response, please check the screenshot.

                          https://prnt.sc/tqhuuc
                          https://prnt.sc/tqhuc2

                          Can you please share a short video or screenshots to debug the issue.

                          Thanks!

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