This is an experimental technologyCheck the Browser compatibility table carefully before using this in production.
The create()
method of the CredentialsContainer
interface returns a Promise
that resolves with a new Credential
instance based on the provided options, or null
if no Credential
object can be created.
This method is restricted to top-level contexts. Calls to it within an <iframe>
element will resolve without effect.
Syntax
var promise = CredentialsContainer.create([options])
Parameters
- options
- An object of type
CredentialCreationOptions
that contains options for the requested newCredentials
object. It must include one of the options "password", "federated", or "publicKey". The options are:
- password
- Optional Either an
HTMLFormElement
, or aPasswordCredentialData
object. TBD
- Optional Either an
id
- (required)
USVString
Inherited fromCredentialData
. name
: OptionalUSVString
TBDiconURL
: OptionalUSVString
TBDpassword
: (required)USVString
TBD
- (required)
- federated
- Optional An
FederatedCredentialInit
object. Contains requirements for creating/obtaining federated credentials. The available options are:
- Optional An
id
publicKey
- Optional an
PublicKeyCredentialCreationOptions
object that describes the options for creating a WebAuthn credential.
- Optional an
Returns
A Promise
that resolves with a Credential
instance, such as PasswordCredential
, FederatedCredential
, or PublicKeyCredential
.
Specifications
Specification | Status | Comment |
Credential Management Level 1The definition of 'get()' in that specification. | Working Draft | Initial definition. |
Web Authentication: An API for accessing Public Key Credentials Level 1 | Recommendation | Initial definition. |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Chrome
Full support 60 |
Edge
Full support 18 |
Firefox
Full support Yes |
IE
No support No |
Opera
No support No |
Safari
Full support 13 |
WebView Android
Full support 60 |
Chrome Android
Full support 60 |
Firefox Android
Full support Yes |
Opera Android
No support No |
Safari iOS
Full support 13.3 |
Samsung Internet Android
Full support 8.0 |
Legend
- Full support
- Full support
- No support
- No support
- Experimental. Expect behavior to change in the future.'
- Experimental. Expect behavior to change in the future.
CredentialsContainer.create() by Mozilla Contributors is licensed under CC-BY-SA 2.5.