Get Unique device id with php or javascript
Asked Answered
R

2

5

I'm looking for something that allow me to get devices (pc, Mac, phone and tablet) unique id like a MAC address can be.

I need to track all logins into a protected area but i'm unable to find an unique id with whom I can identify the used device.

I need that because I want the user to register their devices and then let them login only with that. Thanks

Rodmur answered 7/2, 2019 at 17:53 Comment(1)
I think you are looking for IP white listing, #35559619Bentonbentonite
A
6

You can’t really. It would be a huge security/privacy risk to do that. However, there some things that you could do to get close:

  1. Add a cookie to that device with a UUID

  2. Fingerprinting - Use all available browser settings available to JS such as browser agent, installed fonts etc. to build up a unique-ish profile of a device (Note. Apple try to prevent this in the latest version of Safari)

  3. IP address. It’s not perfect but is can do something and there are ways to remove a small degree of obfuscation. This is an example in PHP: How to get Real IP from Visitor?

Combining all of these things together should be able to give you something close to what you want. It may not completely protect it, but it will offer some form of it.

Arieariel answered 7/2, 2019 at 18:11 Comment(0)
C
0

JavaScript is a high level programming language which can not help you storing such information. Same applies to PHP as well.

However, you might want to consider making use of cookies to achieve your goal. You can use a cryptographic algorithm and store it in a cookie, and you have a unique identifier.

Celandine answered 7/2, 2019 at 17:58 Comment(1)
@Rodmur Thats your best shot tbh. What you might also look into is consider a signed applet using JavaCelandine

© 2022 - 2024 — McMap. All rights reserved.