web api interface
Credential
Secure context
The Credential interface of the Credential Management API provides information about an entity (usually a user) normally as a prerequisite to a trust decision.
Credential objects may be of the following types:
Instance properties
idRead only- : Returns a string containing the credential’s identifier. This might be any one of a GUID, username, or email address.
typeRead only- : Returns a string containing the credential’s type. Valid values are
password,federated,public-key,identityandotp. (ForPasswordCredential,FederatedCredential,PublicKeyCredential,IdentityCredentialandOTPCredential)
- : Returns a string containing the credential’s type. Valid values are
Static methods
Credential.isConditionalMediationAvailable()- : Returns a
Promisewhich always resolves tofalse. Subclasses may override this value.
- : Returns a
Examples
const pwdCredential = new PasswordCredential({
id: "example-username", // Username/ID
name: "Carina Anand", // Display name
password: "correct horse battery staple", // Password
});
console.assert(pwdCredential.type === "password");
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.