• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Register
  • Login
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
2.0k
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 28 Jul 2020, 07:21

    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 28 Jul 2020, 09:00

      Hello there,

      have you tried this endpoint ?

      1 Reply Last reply Reply Quote 0
      • S
        sanjay last edited by sanjay 28 Jul 2020, 11:09 28 Jul 2020, 11:05

        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 28 Jul 2020, 11:16 28 Jul 2020, 11:16

          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 28 Jul 2020, 11:19

            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 28 Jul 2020, 11:20

              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 28 Jul 2020, 11:26

                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 28 Jul 2020, 11:37 28 Jul 2020, 11:36

                  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 28 Jul 2020, 11:49

                    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 28 Jul 2020, 12:45

                      No, not getting customer details using that.

                      1 Reply Last reply Reply Quote 0
                      • shubhwebkul
                        shubhwebkul last edited by 29 Jul 2020, 11:40

                        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
                        5 out of 11
                        • First post
                          5/11
                          Last post