@dingo_d You can use below statement to logout
Auth::logout();
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I've implemented user authentication on an old project such that a user is authenticated on Laravel.
A user goes to the old app, gets redirected to the Laravel login screen, a passport token is created and the user gets redirected back to the old app.
This works. Now I am implementing the logout functionality, and I am sending a request to my logout API call, but since this request doesn't have anything to do with the web request, I cannot do
$request->session()->invalidate();
Because there is no session associated with this request (API call).
I'm trying to find out is there a way to invalidate a session for a user from my API call.
I can get the user details because I have a bearer token, so $request->user()->token()->revoke(); works.
I tried to find a way to get all the sessions from a user, but no luck so far.
Please or to participate in this conversation.