Get your free and exclusive 80-page Banking Passkey Report

How do I enable passkeys in an iframe?

Learn the step-by-step process to enable passkeys in iframes, including essential permissions, HTTP headers, and user activation requirements.

Vincent Delitz

Vincent

Created: April 7, 2025

Updated: August 13, 2025

enable passkeys iframe

iframe passkeys webauthn cover

Read the full article

Discover how to create & login with passkeys in cross-origin iframes with our guide. Learn about iframes in WebAuthn, security policies & implementation.

Read the full article

Read by 5,000+ security leaders.

How do I enable passkeys in an iframe?#

Enabling passkeys in iframes involves configuring specific permissions, headers, and user interaction conditions. Here's a step-by-step guide:

1. Set Permissions-Policy#

First, specify permissions using the iframe's allow attribute:

<iframe src="https://example.com" allow="publickey-credentials-get; publickey-credentials-create" ></iframe>

2. Configure HTTP Headers#

Include the corresponding HTTP response headers on your iframe source server to explicitly allow WebAuthn operations:

Permissions-Policy: publickey-credentials-get=(*), publickey-credentials-create=(*)

For enhanced security, limit to specific domains instead of *:

Permissions-Policy: publickey-credentials-get=("https://yourdomain.com"), publickey-credentials-create=("https://yourdomain.com")

3. Handle User Activation#

Passkey operations (creation or authentication) must be triggered by a clear user action (also called "transient user activation"). Use event listeners for buttons or form submissions:

document.getElementById("loginPasskeyButton").addEventListener("click", async () => { try { const credential = await navigator.credentials.get({ publicKey: publicKeyCredentialRequestOptions, }); // Handle the authenticated credential } catch (err) { console.error("Passkey authentication error:", err); } });

4. Test and Validate#

Verify correct Permissions-Policy settings in browser developer tools under the "Application → Frames" section.

WhitepaperEnterprise Icon

60-page Enterprise Passkey Whitepaper:
Learn how leaders get +80% passkey adoption. Trusted by Rakuten, Klarna & Oracle

Get free Whitepaper

Conduct cross-browser testing, especially in browsers with strict cross-origin rules (e.g., Safari).

Following these steps ensures secure and seamless passkey integration in iframes. .

Read the full article#

iframe passkeys webauthn cover

Read the full article

Discover how to create & login with passkeys in cross-origin iframes with our guide. Learn about iframes in WebAuthn, security policies & implementation.

Read the full article

Read by 5,000+ security leaders.

Learn more about our enterprise-grade passkey solution.

Learn more

Share this article


LinkedInTwitterFacebook

Related FAQs

Related Terms