Search code examples
phplaravel

Control user to login from only specific device that provided to the user


I am trying to develop the software for college students, we will provide device to the students (tab/laptops) they must need to log in their credentials using the device that we provided to the student. E.g. If student 1 tried to log in from student 2's tab/laptop, then it needs to be rejected.

Is there any way available to get the MAC address of the client's PC using PHP, and JavaScript?

We developed web applications using PHP 5.3 with jQuery and JS, also another is Laravel with PHP 8.1.

Is there any best way available to restrict the user to login from only the device specified?

I have tried by controlling the user via MAC address using this answer but it's not working in our case.


Solution

  • The answer you linked actually answers your question.

    If you want to restrict access by device, the MAC address is what should be used (even though it's easily spoofed as noted by Jerry in their comment).

    However, this isn't going to be available to you unless you're on the same network (as noted by the answer you linked).

    In reality, however, it won't be possible for you to securely restrict access to individual devices through the web. That's why we have usernames and passwords!

    It's probably worth doing some research yourself into the techniques used by similar software to solve the same problem. You won't find a web application which does what you suggest, but perhaps you'll find a different technique which will work for you.