0

So I want to use a flash drive as an option for 2FA on my website(using the devices serial umber). I am using WebUSB, but the flash drive won't show up in the device selection window. I have seen that web USB can't read/write files, so can it even see flash drives?

Here's my code if it helps:

console.log("test");
 usbLookup.addEventListener('click', function() {
 navigator.usb.requestDevice({ filters: [{ }] })
.then(device => {
  console.log(device.serialNumber);      
 
})
.catch(error => { console.log(error); });
});
<iframe allowpaymentrequest allow='usb'></iframe>

<a id="usbLookup">Get Serial</a>
Lgfhhh
  • 3
  • 5

1 Answers1

0

On some platforms WebUSB can't see flash drives due to particulars in how it is implemented.

In general this is a poor second factor because a serial number is easy to guess and fake. I recommend using the WebAuthn API instead which provides support for truely secure tokens available from multiple vendors.

Reilly Grant
  • 5,590
  • 1
  • 13
  • 23