Nitin Srivastava
Nitin Srivastava

Reputation: 37

How to get auth user in Laravel controller when using the Laravel passport for API?

Will auth::user() work to get authorized credentials?

If not how can I get those?

Upvotes: 1

Views: 450

Answers (2)

Andres Felipe
Andres Felipe

Reputation: 4330

with passport i use return Auth::guard('api')->user();

Upvotes: 2

user320487
user320487

Reputation:

With Passport you can access the user via the request object:

$request->user()

Upvotes: 0

Related Questions