Home > Net >  laravel passport optional authentication
laravel passport optional authentication

Time:03-28

I have been using Laravel passport to response Api data, I want to response favorite status by user of product if a user login (token paste in header to validate with passport authentication Middleware). Is there a solution to determine if a user login or not without using Middleware "api" in route Api or separate Api url based user login and non user-login?

CodePudding user response:

I just found out that without middleware we can use Auth::guard('api') to validate the bearer token.

  • Related