PublicKeyCredential.response

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2021.

安全なコンテキスト用: この機能は一部またはすべての対応しているブラウザーにおいて、安全なコンテキスト (HTTPS) でのみ利用できます。

responsePublicKeyCredential インターフェイスの読み取り専用プロパティで、このプロパティは AuthenticatorResponse オブジェクトであり、資格情報の作成/取得のために認証先からユーザーエージェントに送信されるものです。このレスポンスに含まれる情報は、要求が正当なものであるかどうかを確認するために、依存している側のサーバーで使用されます。

AuthenticatorResponse は以下のどちらかです。

資格情報の生成を検証するには、依存している側のサーバーは以下の両方を必要とします。

メモ: 既存の資格情報の取得を検証する場合、 PublicKeyCredential オブジェクト全体とクライアント拡張機能が依存している側のサーバーに必要です。

メモ: このプロパティは最上位のコンテキストでのみ使用することができます。例えば <iframe> では使用することができません。

作成または取得の要求を検証するために、依存する側のスクリプトが受信し、依存する側がのサーバーに送信されるべきデータを含む AuthenticatorResponse オブジェクトです。このオブジェクトには、クライアントからのデータ (AuthenticatorResponse/clientDataJSON) と認証器からのデータが含まれます。

js
const options = {
  challenge: new Uint8Array(16) /* from the server */,
  rp: {
    name: "Example CORP",
    id: "login.example.com",
  },
  user: {
    id: new Uint8Array(16) /* from the server */,
    name: "canand@example.com",
    displayName: "Carina Anand",
  },
  pubKeyCredParams: [
    {
      type: "public-key",
      alg: -7,
    },
  ],
};

navigator.credentials
  .create({ publicKey: options })
  .then((pubKeyCredential) => {
    const response = pubKeyCredential.response;
    const clientExtResults = pubKeyCredential.getClientExtensionResults();
    // Send response and client extensions to the server so that it can validate
    // and create credentials
  })
  .catch((err) => {
    // Deal with any error
  });

仕様書

Specification
Web Authentication: An API for accessing Public Key Credentials - Level 3
# dom-publickeycredential-response

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
response

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support
No support
No support
See implementation notes.
Has more compatibility info.