diff --git a/apps/browser/src/vault/fido2/content/page-script.ts b/apps/browser/src/vault/fido2/content/page-script.ts index 44a443b89e..e072ea20ef 100644 --- a/apps/browser/src/vault/fido2/content/page-script.ts +++ b/apps/browser/src/vault/fido2/content/page-script.ts @@ -66,6 +66,10 @@ navigator.credentials.create = async ( options?: CredentialCreationOptions, abortController?: AbortController ): Promise => { + if (!isWebauthnCall(options)) { + return await browserCredentials.create(options); + } + const fallbackSupported = (options?.publicKey?.authenticatorSelection.authenticatorAttachment === "platform" && browserNativeWebauthnPlatformAuthenticatorSupport) || @@ -106,6 +110,10 @@ navigator.credentials.get = async ( options?: CredentialRequestOptions, abortController?: AbortController ): Promise => { + if (!isWebauthnCall(options)) { + return await browserCredentials.get(options); + } + const fallbackSupported = browserNativeWebauthnSupport; try { @@ -141,6 +149,10 @@ navigator.credentials.get = async ( } }; +function isWebauthnCall(options?: CredentialCreationOptions | CredentialRequestOptions) { + return options && "publicKey" in options; +} + /** * Wait for window to be focused. * Safari doesn't allow scripts to trigger webauthn when window is not focused.