Skip to content
ecdsa.com
WebAuthn navigator.credentials.create() / get()WebAuthn and passkeys

Error message

SecurityError: The relying party ID is not a registrable domain suffix of, nor equal to the current domain. Subsequently, an attempt to fetch the .well-known/webauthn resource of the claimed RP ID failed.

Also printed as

  • SecurityError: The relying party ID is not a registrable domain suffix of, nor equal to the current domain.

Chromium versions without Related Origin Requests support end the sentence after "…nor equal to the current domain.". Other browsers word it differently; the DOMException name `SecurityError` is the stable part.

WebAuthn navigator.credentials.create() / get() — DOMException SecurityError (Chromium)

What it means

The RP ID in your options is not the page's own host name or a registrable parent of it, so the browser refused to create or use a credential for it. A passkey is bound to its RP ID; letting any page claim any RP ID would let one site use another site's passkeys. Chromium also tried the WebAuthn Related Origin Requests mechanism (fetching `https://<rp-id>/.well-known/webauthn` to see whether the RP ID lists your origin) and that did not authorise the request either.

Why it happens

How to fix it

  1. 1.

    Configure the RP ID per environment

    Keep RP ID and expected origin together in environment configuration so development, preview and production each use their own host — and remember that passkeys do not move between RP IDs.

    js
    // Server: derive the RP ID from configuration per environment, never hard-code production.
    const rpID = process.env.WEBAUTHN_RP_ID;          // "localhost" in dev, "example.com" in production
    const expectedOrigin = process.env.WEBAUTHN_ORIGIN; // "http://localhost:3000" / "https://app.example.com"
    const options = await generateRegistrationOptions({ rpName: "Example", rpID, userName });
  2. 2.

    Publish related origins deliberately

    If several of your domains must share passkeys, serve `/.well-known/webauthn` on the RP ID's domain listing them (supported by current Chromium and Safari).

    json
    // https://example.com/.well-known/webauthn  (served as application/json)
    {
      "origins": ["https://example.co.uk", "https://example-shop.com"]
    }

Related errors

Browse the full signature error database