Get to know MDN better
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
The Credential Management API enables a website to create, store, and retrieve credentials. A credential is an item which enables a system to make an authentication decision: for example, to decide whether to sign a user into an account. We can think of it as a piece of evidence that a user presents to a website to demonstrate that they really are the person they are claiming to be.
The central interface is the CredentialsContainer, which is accessed through the navigator.credentials property and provides three main functions:
The API supports four different types of credential, which are all represented as subclasses of Credential:
| Password | PasswordCredential |
| Federated identity | IdentityCredential, FederatedCredential (deprecated) |
| One-time password (OTP) | OTPCredential |
| Web Authentication | PublicKeyCredential |
The guide page Credential types gives an overview of the different credential types and how they are used.
Provides information about an entity as a prerequisite to a trust decision.
CredentialsContainerExposes methods to request credentials and notify the user agent when interesting events occur such as successful sign in or sign out. This interface is accessible from navigator.credentials.
FederatedCredentialProvides information about credentials from a federated identity provider, which is an entity that a website trusts to correctly authenticate a user, and which provides an API for that purpose. OpenID Connect is an example of such a framework.
PasswordCredentialProvides information about a username/password pair.
Returns the CredentialsContainer interface which exposes methods to request credentials and notify the user agent when interesting events occur such as successful sign in or sign out.
| Credential Management Level 1 |
Enable JavaScript to view this browser compatibility table.
Enable JavaScript to view this browser compatibility table.
Enable JavaScript to view this browser compatibility table.
Enable JavaScript to view this browser compatibility table.
This page was last modified on Jun 4, 2024 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.