Home > Software engineering >  how to get client unique ip in laravel or anything unique that can identify the user device
how to get client unique ip in laravel or anything unique that can identify the user device

Time:06-22

i need to get anything that can be unique and related to the user's device. I have used this method to get the client's IP

    $worker_ip = $request->IP();

it works well, but if many users share the same WIFI, it returns the same number. so I need to know if anything can be unique I can fetch to identify the client's device

CodePudding user response:

If you are looking for a unique thing you can follow along

$uid = uniqid() # 62b270bce4f9e
  • This will give you a unique identifier for each user

CodePudding user response:

The IP itself doesn't identify an user device as you said.

If you want to create some kind of authentication system where you can see the signed devices you will have to store more than one information.

You can store the User-Agent request header, the location, IP, and the last login time. If it is a mobile device you can get the model, name etc.

And if you want to invalidate the signed device it will need to be attached to a token authentication system and the token will have to be invalidated.

  • Related