admin管理员组

文章数量:1379913

I have a specific need which is giving me some hard time. The basic requirement is: We need to Uniquely Identify the Device(can be a PC, Mac, Tablet, Phone) via one ID, just like an IMEI... This is needed due to some Licensing restrictions of some applications.

The challenge: We are running a Angular and the browser makes it nearly impossible to uniquely identify the device. As we are on the Browser sandbox, I have no chance to get something like a Mac address or anything that would be a good start in defining a unique ID.

What we tried so far:

  • MediaDeviceInfo.deviceId:

    • In one hand, on the first tests I made on my Chrome, it came empty and additionally it is not supported on Safari...
  • Valve´s FingerprintJS2: /

    • At a first sight we think we hit the Jackpot as it properly generated the same ID, even if I called it from an Anonymous window! But, It still generates another ID for a different browser...
    • Basically It works by enumerating all browser capabilities(at least the ones accessible) and then by creating a hash of that... The Issue: If you have devices with exactly same configurations, they will have the same ID! I tried that on 2 iPhones that have the same config and were even bought on same day! :-)
  • Creating UID and saving on Localstorage: create a UID (How to generate UUID in angular 6) and store it on Local Storage. Some issues on our way:

    • If I open an Anonymous window, of course that the LocalStorage would be not there, meaning that I would get a new "UUID"
    • Besides that, we have some individual angular applications and they would need to share the local storage, which is not possible to do due to the SameOrigin security Limitation. We could overe it using an iFrame and the PostMessage (). There are actuyll some NPM packages doing that as this one: . Being honest, we do not like much the idea of create a "cross-domain-local-storage"...

I am aware that this problem has no easy solution, but I wanted to ask here if Someone faced a situation like this and how did they solve it. Of course if I would be able to run out of the browser sandbox having direct Access to device Information such as MAC address, IMEI or anything like that, it would be easy, but as mentioned, the browser sandbox is restrictive...

Ideas?

Thanks in advance!!!

Pedro

I have a specific need which is giving me some hard time. The basic requirement is: We need to Uniquely Identify the Device(can be a PC, Mac, Tablet, Phone) via one ID, just like an IMEI... This is needed due to some Licensing restrictions of some applications.

The challenge: We are running a Angular and the browser makes it nearly impossible to uniquely identify the device. As we are on the Browser sandbox, I have no chance to get something like a Mac address or anything that would be a good start in defining a unique ID.

What we tried so far:

  • MediaDeviceInfo.deviceId: https://developer.mozilla/en-US/docs/Web/API/MediaDeviceInfo/deviceId

    • In one hand, on the first tests I made on my Chrome, it came empty and additionally it is not supported on Safari...
  • Valve´s FingerprintJS2: https://valve.github.io/fingerprintjs2/

    • At a first sight we think we hit the Jackpot as it properly generated the same ID, even if I called it from an Anonymous window! But, It still generates another ID for a different browser...
    • Basically It works by enumerating all browser capabilities(at least the ones accessible) and then by creating a hash of that... The Issue: If you have devices with exactly same configurations, they will have the same ID! I tried that on 2 iPhones that have the same config and were even bought on same day! :-)
  • Creating UID and saving on Localstorage: create a UID (How to generate UUID in angular 6) and store it on Local Storage. Some issues on our way:

    • If I open an Anonymous window, of course that the LocalStorage would be not there, meaning that I would get a new "UUID"
    • Besides that, we have some individual angular applications and they would need to share the local storage, which is not possible to do due to the SameOrigin security Limitation. We could overe it using an iFrame and the PostMessage (https://levelup.gitconnected./share-localstorage-sessionstorage-between-different-domains-eb07581e9384). There are actuyll some NPM packages doing that as this one: https://github./ofirdagan/cross-domain-local-storage. Being honest, we do not like much the idea of create a "cross-domain-local-storage"...

I am aware that this problem has no easy solution, but I wanted to ask here if Someone faced a situation like this and how did they solve it. Of course if I would be able to run out of the browser sandbox having direct Access to device Information such as MAC address, IMEI or anything like that, it would be easy, but as mentioned, the browser sandbox is restrictive...

Ideas?

Thanks in advance!!!

Pedro

Share Improve this question asked Aug 20, 2020 at 13:40 PCBLPCBL 711 gold badge1 silver badge4 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

I'm going to refer you to an answer I wrote back in 2018 which is still pretty much the same now: how can I get a unique device ID in javascript?

The short answer is: you can't, really.

You won't be able to get anything that uniquely identifies a device across all browsers and incognito vs regular. As you've found, you can get close, but it isn't a sure thing.

The best you can do is bine a couple of techniques together (like the fingerprint + stored UID) and it'll probably get 99% of cases, but you won't be able to get them all for sure.

本文标签: Unique DeviceID on Javascript Web Application(AngularReact)Stack Overflow