CredentialsContainer

这是 实验性技术
检查 浏览器兼容性表格 在生产中使用这之前。

Secure context
This feature is available only in secure contexts (HTTPS), in some or all supporting browsers .

CredentialsContainer interface of the the 证书管理 API exposes methods to request credentials and notify the user agent when events such as successful sign in or sign out happen. This interface is accessible from Navigator.credentials .

特性

None.

事件处理程序

None.

方法

CredentialsContainer.create() Secure context
返回 Promise that resolves with a new Credential instance based on the provided options, or null if no Credential object can be created. In exceptional circumstances, the Promise may reject.
CredentialsContainer.get() Secure context
返回 Promise that resolves with the Credential instance that matches the provided parameters.
CredentialsContainer.preventSilentAccess() Secure context
Sets a flag that specifies whether automatic log in is allowed for future visits to the current origin, then returns an empty Promise . For example, you might call this, after a user signs out of a website to ensure that he/she isn't automatically signed in on the next site visit. Earlier versions of the spec called this method requireUserMediation() 。见 浏览器兼容性 for support details.
CredentialsContainer.store() Secure context
Stores a set of credentials for a user, inside a provided Credential instance and returns that instance in a Promise .

范例

// TBD
					

规范

规范 状态 Comment
Credential Management Level 1 工作草案 初始定义。
Web Authentication: An API for accessing Public Key Credentials Level 1 Recommendation 初始定义。

浏览器兼容性

更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
CredentialsContainer
Chrome 51 Edge 18 Firefox Yes IE ? Opera 不支持 No Safari 13 WebView Android 51 Chrome Android 51 Firefox Android Yes Opera Android 不支持 No Safari iOS 13.3 Samsung Internet Android 5.0
create
Chrome 60 Edge 18 Firefox Yes IE ? Opera 不支持 No Safari 13 WebView Android 60 Chrome Android 60 Firefox Android Yes Opera Android 不支持 No Safari iOS 13.3 Samsung Internet Android 8.0
get
Chrome 51 Edge 18 Firefox Yes IE ? Opera 不支持 No Safari 13 WebView Android 51 Chrome Android 51 Firefox Android Yes Opera Android 不支持 No Safari iOS 13.3 Samsung Internet Android 5.0
preventSilentAccess
Chrome 60
60
51 — 60
Alternate Name
Alternate Name Uses the non-standard name: requireUserMediation
Edge ≤79 Firefox Yes IE ? Opera 不支持 No Safari ? WebView Android 60
60
51 — 60
Alternate Name
Alternate Name Uses the non-standard name: requireUserMediation
Chrome Android 60
60
51 — 60
Alternate Name
Alternate Name Uses the non-standard name: requireUserMediation
Firefox Android Yes Opera Android 不支持 No Safari iOS ? Samsung Internet Android 8.0
8.0
5.0 — 8.0
Alternate Name
Alternate Name Uses the non-standard name: requireUserMediation
store
Chrome 51 Edge ≤79 Firefox Yes IE ? Opera 不支持 No Safari ? WebView Android 51 Chrome Android 51 Firefox Android Yes Opera Android 不支持 No Safari iOS ? Samsung Internet Android 5.0

图例

完整支持
完整支持
不支持
不支持
兼容性未知
兼容性未知
实验。期望将来行为有所改变。
实验。期望将来行为有所改变。
使用非标名称。
使用非标名称。