Getting User Data based on token in Cart Checkout API
-
Hello there,
have you tried this endpoint ?
-
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.
-
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! -
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.
-
I mean is anything i need to pass for that ya only need to pass token?
-
You only need to pass token in that API. have you tried fetching user as used here
-
Yes I checked that also but $customer is blank
$customer = auth($this->guard)->user();
-
Sanjay,
are you getting customer details with the help of auth('customer')->user(); ?
-
No, not getting customer details using that.
-
Hello there,
As I am checking I am getting customer email in response, please check the screenshot.
https://prnt.sc/tqhuuc
https://prnt.sc/tqhuc2Can you please share a short video or screenshots to debug the issue.
Thanks!