New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Web Bluetooth PIN pairing fails on Windows #33111
Comments
@jkleinsc Anything else I can do to help with this? |
@jkleinsc @dsanders11 @codebytere It looks like this also affects devices that pair without a PIN, and still exists on Electron v19. Please let me know if there's anything I can do to help move this forward or make it easier to debug. |
@gniezen I have a fix about ready to go but I was wondering if you know of any specific devices to test with? |
@gniezen I see this linked issue: tidepool-org/uploader#1515. Will this device work to test the issue: https://www.walmart.com/ip/Contour-Next-ONE-Blood-Glucose-Monitoring-System-Value-Pack/278244026 ? |
Hi @jkleinsc ! Yes, the Contour Next One meter will definitely work to test with. Here's how to put it in pairing mode: Here is where it currently fails in my code: this.server = await this.device.gatt.connect();
this.deviceInfoService = await this.server.getPrimaryService('device_information');
this.glucoseService = await this.server.getPrimaryService('glucose');
const glucoseFeature = await this.glucoseService.getCharacteristic('glucose_feature');
const features = await glucoseFeature.readValue(); I can connect to the device, but when I try to read the protected characteristic, I expect to have to enter the pairing PIN. Instead it returns an error like |
@gniezen I have been testing #35416 with the Contour Next One meter on Windows 11 and it looks like that particular device does not require a pairing PIN. I verified this by testing in Chrome and Edge using https://googlechrome.github.io/samples/web-bluetooth/get-characteristics.html to test. Both browsers never prompted for a pin but they were able to successfully get the Electron does throw an error calling |
@gniezen - I think maybe my Electron test was doing something wrong, because when I run the code from https://googlechrome.github.io/samples/web-bluetooth/get-characteristics.html in Electron with the build from #35416, it works with errors. So I believe #35416 should resolve your issue. |
@jkleinsc It looks like even though the Contour Next One meter does allow for PIN pairing, it can also use Just Works pairing, so it doesn't necessarily require the PIN pairing dialog box. Sorry, I should've checked this in more detail. When I use a meter that does require a PIN (e.g. the Accu-chek Guide Me) the browser shows this screen: I agree that #35416 should resolve the issue. Please let me know when there's a build available that I can test! |
@jkleinsc I was just looking into this again and realised support for confirm-only support only became available in Chrome v105.0.5195.68, and is still hidden behind a flag https://bugs.chromium.org/p/chromium/issues/detail?id=1309715 |
@jkleinsc I can't seem to get any devices that use confirm-only PIN pairing to work. Should I file a new bug report? |
@gniezen I think the PIN pairing requires the app.commandLine.appendSwitch('--enable-features=WebBluetoothConfirmPairingSupport') If that fails to work, feel free to open up a new issue with a reproducible test case. |
Thanks @jkleinsc , I got it working! 🎉 I previously had app.commandLine.appendSwitch('enable-features', 'SharedArrayBuffer,WebBluetoothConfirmPairingSupport'); Thank you so much - it's such a relief to be able to support Bluetooth PIN/confirm pairing on Windows! |
Preflight Checklist
Electron Version
17.0.1
What operating system are you using?
Windows
Operating System Version
Windows 10 Pro 1909
What arch are you using?
x64
Last Known Working Electron version
No response
Expected Behavior
When pairing a device using the Web Bluetooth API that requires a PIN, I expect the PIN pairing dialog box to appear.
Actual Behavior
PIN pairing dialog box does not appear, and operation fails with "GATT error: Not paired."
Testcase Gist URL
No response
Additional Information
Web Bluetooth PIN pairing has always worked on MacOS, but there was a Chromium bug that prevented it from working on Windows. This bug has since been fixed, at least since Chromium v96.0.4664.110.
The text was updated successfully, but these errors were encountered: