資格情報管理 API

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

資格情報管理 API を使用すると、ウェブサイトがユーザー、連携アカウント、公開鍵の資格情報を保存および取得することができます。これらの機能により、ユーザーはパスワードを入力せずにログインしたり、サイトへのログインに使用した連携アカウントを確認したり、期限切れのセッションに明示的なログインの手続きなしでセッションを再開したりすることができます。

概念と使用方法

この API により、ウェブサイトがユーザーエージェントのパスワードシステムと直接対話できるようになるため、ウェブサイトはサイトの資格情報を統一した方法で扱うことができ、ユーザーエージェントは資格情報の管理でより良い支援を提供することができるようになります。例えば、ユーザーエージェントは、連合アイデンティティプロバイダーや、ユーザー名とパスワードだけでなく、それ以上のものを使用する難解なログインメカニズムを扱うのに特に苦労しています。

これらの問題に対処するために、資格情報管理 API は、ウェブサイトがさまざまな種類の資格情報を保存したり取得したりする方法を提供しています。これによりユーザーは、サイトにログインするために使用した連携アカウントを確認したり、期限切れのセッションに明示的なログインの手続きなしでセッションを再開したりすることができます。

メモ: この API は最上位のコンテキストのみに制限されています。 get()store()<iframe> 要素の中で呼び出すと、何もせずに解決します。

サブドメイン間で共有される資格情報

より新しい版の仕様では、別のサブドメインから資格情報を取得できるようになっています。例えば、 login.example.com に保存されているパスワードを使用して www.example.com にログインすることができます。これを利用するには、CredentialsContainer.store() を呼び出してパスワードを明示的に格納する必要があります。これは、公開接尾辞リスト (PSL) 照合と呼ばれることもあるりますが、仕様では、資格情報の有効なスコープを決定するために PSL を使用することを推奨しているだけです。必須ではありません。そのため、ブラウザーによって実装が異なる場合があります。

インターフェイス

Credential

信頼の決定の前提条件として、エンティティに関する情報を提供します。

CredentialsContainer

ログインやログアウトの成功などの興味深いイベントが発生したときに、資格情報を要求し、ユーザーエージェントに通知するメソッドを公開します。このインターフェイスは navigator.credentials からアクセスできます。

FederatedCredential

ウェブサイトがユーザーを正しく認証するために信頼するエンティティである、連合アイデンティティプロバイダーからの資格情報に関する情報を提供し、また、そのための API を提供します。 OpenID Connect はそのようなフレームワークの一例です。

PasswordCredential

ユーザー名/パスワードの組に関する情報を提供します。

他のインターフェイスへの拡張

資格情報をリクエストするメソッドや、ログインやログアウトに成功したときなど興味深いイベントが発生したときに ユーザーエージェントに通知するメソッドを公開する CredentialsContainer インターフェイスを返します。

仕様書

Specification
Credential Management Level 1

ブラウザーの互換性

api.Credential

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
Credential
id
isConditionalMediationAvailable() static method
Experimental
type

Legend

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

Full support
Full support
No support
No support
Experimental. Expect behavior to change in the future.

api.CredentialsContainer

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
CredentialsContainer
create
publicKey option
attestation option
attestation.direct
attestation.enterprise
attestation.indirect
attestation.none
create() extensions
appidExclude extension
credProps extension
credProtect extension
Experimental
largeBlob extension
minPinLength extension
payment extension
publicKey_option.requireResidentKey
Experimental
publicKey_option.residentKey
get
identity option
Experimental
identity.context
Experimental
Error API
ExperimentalNon-standard
identity.providers.loginHint
Experimental
otp option
Experimental
publicKey option
get() extensions
appid extension
largeBlob extension
Experimental
preventSilentAccess
store

Legend

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

Full support
Full support
Partial support
Partial support
No support
No support
Experimental. Expect behavior to change in the future.
Non-standard. Check cross-browser support before using.
See implementation notes.
Uses a non-standard name.
Has more compatibility info.

api.FederatedCredential

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
FederatedCredential
Experimental
FederatedCredential() constructor
Experimental
iconURL
Experimental
name
Experimental
protocol
Experimental
provider
Experimental

Legend

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

Full support
Full support
No support
No support
Experimental. Expect behavior to change in the future.
See implementation notes.

api.PasswordCredential

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
PasswordCredential
Experimental
PasswordCredential() constructor
Experimental
iconURL
Experimental
name
Experimental
password
Experimental

Legend

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

Full support
Full support
No support
No support
Experimental. Expect behavior to change in the future.
See implementation notes.

関連情報