Search code examples
google-chromewebauthn

Can a chrome extension directly initiate the (chrome) WebAuthn / PassKey dialogue?


I have a TS-based web app that calls upon WebAuthn and opens the chrome dialogue to select PassKey method - working as expected.

When the same code is used inside a chrome extension, the request to the server for auth is received and returns the first part of the response with no errors (200), however no WebAuthn native dialogue appears. Still no network or log errors on front or back end.

I am struggling to find any documentation that suggests how a chrome extension does or does not handle WebAuthn / PassKeys directly.


Solution

  • Background pages, when open in a tab, can use WebAuthn. Leave the rp.id field blank and the RP ID will be chrome-extension://…. (I.e. this is only useful for extensions issuing credentials to themselves, so think about that first because it's a significant limitation.)

    There is support behind a flag in Chrome to allow background pages to use a regular origin as an RP ID and something might be done with manifests too, but none of that is released yet.