You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Electron doesn't appear to support WebAuthn, giving the error Uncaught (in promise) DOMException: The user agent does not implement a password store. when you attempt to use navigator.credentials.create, which otherwise works in Chromium.
Describe the solution you'd like
WebAuthn should be supported, it allows for strong security and passwordless experiences. It's built-in to Chromium.
Reacted by Kuroné Kito (黒音キト), Tom, IGGY-CC, jimmylian, akiratfli, Martin Kleinschrodt, François-Xavier Thoorens, Timo Lins and Dom H
👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.
To help make it easier for us to investigate your issue, please follow the contributing guidelines.
This may be simply because Electron seems to be running M66, and WebAuthn was behind a flag until M68. Unfortunately the error isn't very helpful in figuring that out.
@MarshallOfSound, it works there. Apologies for the premature issue, I didn't realize the version of Chromium in Electron 3.x was too old to support WebAuthn. In my mind WebAuthn has been in Chromium for over a year because that's how long I've been playing with it, but I forgot it was behind a flag until recently. I'm going to go ahead and close this since Electron 4.x should fix it.
@dsanders11 Did you happen to specifically test U2F in the E4 beta while you were poking around? I know a whole host of people who would be ecstatic to hear affirmatively that U2F works out of the box in the upcoming Electron version, since many Electron apps with federated login can't currently support the U2F tokens those identity providers require, and WebAuthn is presumably going to natively replace Chrome's current implementation of U2F. 😃
@queesamor, yes, I've tested it fully now with the Electron 4 beta. Granted, I tested with the Yubico Security Key version which supports both U2F and FIDO2, so I can't know for sure it fully supported legacy U2F, but from what I know about the Chromium implementation of WebAuthn, it should support legacy U2F just fine.
Anyone looking to test this in the Electron 4 beta can use the following:
Note that disabling Node integration seems important, otherwise that demo site has an error regarding '$' being undefined, which seems related to #345.
Fantastic news, thank you! A simple adjustment to the libraries on that site will surely solve its specific issue so that disabling node integration isn't required, and presumably any existing apps are already dealing with conflicts in Window in the best way for their own needs.
Here's to hoping nothing regresses before release of v4! 🤞
Having played with this some more, I'm running into some issues getting it to work without a server in the loop in Electron. That's a useful use-case as you may want to provide 2FA for an entirely offline app, or allow a security key to be used to login while offline.
Chromium only allows the WebAuthn API to be used with either https domains (needs a hostname, no bare IP allowed) or http://localhost. For allowing offline usage of an already registered key for login, you'd need to spoof the URL of the site the key was registered at (say, https://github.com). I looked into using protocol interceptors to accomplish this without a server, but had some difficultly there (see #15434). Despite that difficulty, it was at least good enough for a proof-of-concept test, where I ran into the second problem. Changing from the file:// protocol to http:// broke relative file imports between my modules, as the relevant renderer code wasn't run. I again worked around that for a proof-of-concept by simply dumping everything into a single file to sidestep that issue. With that done, the proof-of-concept worked.
@MarshallOfSound, any suggestions for the relative file path issue? I can at least use http://localhost for development until something like #15434 is implemented, but not being able to split my code into different modules is a much bigger pain in the mean time. There are bundlers like webpack, but they don't always play nice with npm packages made for node I've found. Is there any chance Electron's module importer supports a prefix like '@' or '#' to represent the root project directory?
@dsanders11 I'd say the best way forward for this is to make it possible for Electron apps to override this limitation
Chromium only allows the WebAuthn API to be used with either https domains
Some kind of protocol.registerAuthnProtocol API or similar so that custom protocols or event the file:// protocol could support it. The https limitation only makes sense for remote content in a web context, running a desktop app should allow authn 👍
EDIT:
I've only briefly looked into this but I beleive if you render your scheme as standard and secure using the registerStandardSchemes API it should work
DOMException: Public-key credentials are only available to HTTPS origin or HTTP origins that fall under 'localhost'. See https://crbug.com/824383
BTW, that was a painful experience. loadUrl('atom:///webauthn.html') actually loads 'atom://webauthn.html' for starters, making the filename the host this was actually an unexpected (to me) result of making it a standard scheme. At this point if getting this to work requires use of the protocol module I wouldn't recommend anyone try it currently, unless they have a high tolerance for quirks and finding workarounds.
I still don't have a solution for having my code in modules (that require each other) once I switch to custom protocols as I mentioned in the earlier comment.
Activity
welcome commentedon Oct 26, 2018
👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.
To help make it easier for us to investigate your issue, please follow the contributing guidelines.
dsanders11 commentedon Oct 26, 2018
This may be simply because Electron seems to be running M66, and WebAuthn was behind a flag until M68. Unfortunately the error isn't very helpful in figuring that out.
MarshallOfSound commentedon Oct 26, 2018
@dsanders11 Electron 4.x has Chromium 69, can you test on that version?
dsanders11 commentedon Oct 26, 2018
@MarshallOfSound, it works there. Apologies for the premature issue, I didn't realize the version of Chromium in Electron 3.x was too old to support WebAuthn. In my mind WebAuthn has been in Chromium for over a year because that's how long I've been playing with it, but I forgot it was behind a flag until recently. I'm going to go ahead and close this since Electron 4.x should fix it.
queesamor commentedon Oct 26, 2018
@dsanders11 Did you happen to specifically test U2F in the E4 beta while you were poking around? I know a whole host of people who would be ecstatic to hear affirmatively that U2F works out of the box in the upcoming Electron version, since many Electron apps with federated login can't currently support the U2F tokens those identity providers require, and WebAuthn is presumably going to natively replace Chrome's current implementation of U2F. 😃
dsanders11 commentedon Oct 26, 2018
@queesamor, yes, I've tested it fully now with the Electron 4 beta. Granted, I tested with the Yubico Security Key version which supports both U2F and FIDO2, so I can't know for sure it fully supported legacy U2F, but from what I know about the Chromium implementation of WebAuthn, it should support legacy U2F just fine.
Anyone looking to test this in the Electron 4 beta can use the following:
Note that disabling Node integration seems important, otherwise that demo site has an error regarding '$' being undefined, which seems related to #345.
queesamor commentedon Oct 26, 2018
Fantastic news, thank you! A simple adjustment to the libraries on that site will surely solve its specific issue so that disabling node integration isn't required, and presumably any existing apps are already dealing with conflicts in Window in the best way for their own needs.
Here's to hoping nothing regresses before release of v4! 🤞
MarshallOfSound commentedon Oct 26, 2018
@queesamor You should never load a remote site with node integration enabled. It is a massive security issue and puts all your users at risk
queesamor commentedon Oct 26, 2018
:blink: :blink:
I just want to be able to log into Slack with my security key... 🤷♂️
dsanders11 commentedon Oct 28, 2018
Having played with this some more, I'm running into some issues getting it to work without a server in the loop in Electron. That's a useful use-case as you may want to provide 2FA for an entirely offline app, or allow a security key to be used to login while offline.
Chromium only allows the WebAuthn API to be used with either
httpsdomains (needs a hostname, no bare IP allowed) orhttp://localhost. For allowing offline usage of an already registered key for login, you'd need to spoof the URL of the site the key was registered at (say,https://github.com). I looked into using protocol interceptors to accomplish this without a server, but had some difficultly there (see #15434). Despite that difficulty, it was at least good enough for a proof-of-concept test, where I ran into the second problem. Changing from thefile://protocol tohttp://broke relative file imports between my modules, as the relevant renderer code wasn't run. I again worked around that for a proof-of-concept by simply dumping everything into a single file to sidestep that issue. With that done, the proof-of-concept worked.@MarshallOfSound, any suggestions for the relative file path issue? I can at least use
http://localhostfor development until something like #15434 is implemented, but not being able to split my code into different modules is a much bigger pain in the mean time. There are bundlers likewebpack, but they don't always play nice withnpmpackages made fornodeI've found. Is there any chance Electron's module importer supports a prefix like '@' or '#' to represent the root project directory?MarshallOfSound commentedon Oct 28, 2018
@dsanders11 I'd say the best way forward for this is to make it possible for Electron apps to override this limitation
Some kind of
protocol.registerAuthnProtocolAPI or similar so that custom protocols or event thefile://protocol could support it. Thehttpslimitation only makes sense for remote content in a web context, running a desktop app should allow authn 👍EDIT:
I've only briefly looked into this but I beleive if you render your scheme as standard and
secureusing theregisterStandardSchemesAPI it should workdsanders11 commentedon Oct 28, 2018
@MarshallOfSound This didn't work, the error persists:
DOMException: Public-key credentials are only available to HTTPS origin or HTTP origins that fall under 'localhost'. See https://crbug.com/824383BTW, that was a painful experience.
this was actually an unexpected (to me) result of making it a standard scheme. At this point if getting this to work requires use of theloadUrl('atom:///webauthn.html')actually loads 'atom://webauthn.html' for starters, making the filename the hostprotocolmodule I wouldn't recommend anyone try it currently, unless they have a high tolerance for quirks and finding workarounds.I still don't have a solution for having my code in modules (that require each other) once I switch to custom protocols as I mentioned in the earlier comment.
mahnunchik commentedon Jul 16, 2020
Hi @MarshallOfSound @dsanders11 could you please help me to make WebAuthn works from local file.
Registering as a
standardandsecureprotocol doesn't help:More info in my ticket #24573 (fiddle example included)
mahnunchik commentedon Sep 29, 2023
@dsanders11 WebAuthn works in Electron #24573 (comment)