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

pn523's avatar
Level 2

Login constraints with passport in API for different devices

I am making API.

I am using Passport.

I am using custom Login Controller that simply verifies credentials and issues token.

How to handle login check if say a user has logged out from browser but not from other devices like android or ios ??

0 likes
4 replies
henriquesalvan's avatar

@pn First, why do you need this? I think your problem is more related to understanding the authentication concepts than of what you trying to do.

But ok, let's try, if you need check the device of the comming request, you will do something like:

//geting the user agent informations, inside your laravel code
dd(request()->header('User-Agent'));

helpfully have some packages that's make this more easyer:

Package: https://github.com/jenssegers/agent

Full Instruction: https://medium.com/@panjeh/laravel-detector-mobile-browser-name-version-platform-device-robot-crawler-user-language-8499bee7607c

pn523's avatar
Level 2

@henriquesalvan thank you for providing resource. I am a begginer to building API and I do not know of the device logout functionality is handled internally by laravel or not .

Please or to participate in this conversation.