Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

farshadf's avatar

is it possible to get the user in api without using passport using laravel default auth

I have an application which is monolithic. Now I want to get the authenticated user in just like 2 apis in my application. I know that I can use laravel passport to generate tokens and get the user but I want to know if it's possible to get the authenticated user on website in api too. Now in my api controller when I dd() below options I get null:

    dd(auth()->user());
    dd(auth('api')->user());
    dd(Auth::user());

I am using laravel fortify for user login.

0 likes
0 replies

Please or to participate in this conversation.