nextauthjs/next-auth · error · TypeError

Provider id "${provider}" does not refer to a WebAuthn provi

Error message

Provider id "${provider}" does not refer to a WebAuthn provider.
Please use `import { signIn } from "next-auth/react"` instead.

What it means

next-auth v5 splits WebAuthn (passkey) sign-in out of the generic signIn helper. This TypeError is thrown by signIn in "next-auth/webauthn" when the given provider id does not exist or is not a WebAuthn provider, telling you to use the regular "next-auth/react" signIn instead.

Source

Thrown at packages/next-auth/src/webauthn.ts:92

    redirect = true,
    ...signInParams
  } = rest

  const baseUrl = apiBaseUrl(__NEXTAUTH)
  const providers = await getProviders()

  if (!providers) {
    window.location.href = `${baseUrl}/error`
    return // TODO: Return error if `redirect: false`
  }

  if (
    !provider ||
    !providers[provider] ||
    providers[provider].type !== "webauthn"
  ) {
    // TODO: Add docs link with explanation
    throw new TypeError(
      [
        `Provider id "${provider}" does not refer to a WebAuthn provider.`,
        'Please use `import { signIn } from "next-auth/react"` instead.',
      ].join("\n")
    )
  }

  const webAuthnBody: Record<string, unknown> = {}
  const webAuthnResponse = await webAuthnOptions(
    provider,
    __NEXTAUTH,
    signInParams
  )
  if (webAuthnResponse.error) {
    logger.error(new Error(await webAuthnResponse.error.text()))
    return
  }
  webAuthnBody.data = JSON.stringify(webAuthnResponse.data)

View on GitHub (pinned to a1a16a5a77)

Solutions

  1. Use `signIn` from "next-auth/react" for non-WebAuthn providers
  2. Verify the provider id matches a provider of type "webauthn" in your auth config
  3. Check the providers list returned from the server includes the provider id you pass

Example fix

// before
import { signIn } from "next-auth/webauthn"
signIn("github") // TypeError
// after
import { signIn } from "next-auth/react"
signIn("github")
Defensive patterns

Strategy: validation

Validate before calling

const providers = await getProviders() // from next-auth/react
const isWebAuthn = providerId != null && providers?.[providerId]?.type === "webauthn"
if (!isWebAuthn) {
  const { signIn } = await import("next-auth/react")
  return signIn(providerId)
}

Type guard

function isWebAuthnProvider(
  p: unknown
): p is { id: string; type: "webauthn" } {
  return (
    typeof p === "object" && p !== null &&
    (p as any).type === "webauthn"
  )
}

Try / catch

try {
  await webauthnSignIn(providerId)
} catch (e) {
  if (e instanceof TypeError) {
    // wrong entry point or provider id — fall back to generic signIn
    await signIn(providerId)
  } else throw e
}

Prevention

When it happens

Trigger: Calling `signIn(providerId, ...)` from "next-auth/webauthn" with a provider id that is undefined, not present in the providers list, or whose type !== "webauthn".

Common situations: Passing a credentials/oauth provider id (e.g. "credentials", "github") to the WebAuthn-specific signIn; a typo in the provider id; providers config missing the WebAuthn provider so the id lookup fails.

Related errors


AI-assisted analysis of nextauthjs/next-auth@a1a16a5a77 (2026-08-28). Data as JSON: /api/errors/6e21cf6ea61a0c14. Report an issue: GitHub.