navigator.credentials returns a CredentialsContainer — the Credential Management API entry point. Learn feature detection, secure context rules, get() / store() / preventSilentAccess(), five examples, and try-it labs.
01
Kind
Read-only property
02
Returns
CredentialsContainer
03
Baseline
Widely available
04
Context
Secure (HTTPS)
05
Retrieve
get()
06
Save
store()
Fundamentals
Introduction
Modern browsers can help with sign-in: remember passwords, show an account chooser, and restore sessions more smoothly. The Credential Management API is how your page talks to that browser-managed credential store.
Your entry point is navigator.credentials. It is read-only and returns a CredentialsContainer with methods to request credentials and to notify the browser about successful sign-in or sign-out.
💡
Secure context required
MDN: available only in secure contexts (HTTPS / localhost). Feature-detect with "credentials" in navigator and keep a classic login form as fallback.
Concept
Understanding the credentials Property
Think of navigator.credentials as a handle to the browser’s credential manager for this document. You do not assign to it — you call methods on the object it returns.
get(options) — request a credential (for example password or federated).
store(credential) — ask the browser to save a credential after sign-in.
create(options) — create credential objects (varies by credential type).
preventSilentAccess() — after logout, stop automatic silent re-sign-in.
Foundation
📝 Syntax
General form of the property:
JavaScript
navigator.credentials
Value
A CredentialsContainer object associated with the current document.
Common patterns
JavaScript
// MDN feature detect + get:
if ("credentials" in navigator) {
navigator.credentials.get({ password: true }).then((creds) => {
// Use creds, or null if the user cancelled / none found
});
} else {
// Classic sign-in form
}
// After logout:
await navigator.credentials.preventSilentAccess();
navigator.credentials is Baseline Widely available across modern browsers (MDN: since about September 2019). Always use a secure context. Keep a classic sign-in form when the API is missing or the user cancels.
✓ Baseline · Widely available
Navigator.credentials
Feature-detect, call get/store over HTTPS, and use preventSilentAccess after logout.
UniversalWidely available
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
credentialsExcellent
Bottom line: Use navigator.credentials for Credential Management. Require HTTPS and always offer a normal login fallback.
Wrap Up
Conclusion
navigator.credentials is the Credential Management API entry point. Feature-detect it, require HTTPS, use get() / store() thoughtfully, call preventSilentAccess() on logout, and keep a classic form as fallback.
Rely on credentials alone without a server-side session
Forget to clear your own auth cookies on logout
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about credentials
Credential Management entry — get, store, and notify.
5
Core concepts
🔑01
Returns
CredentialsContainer
API
🔍02
Retrieve
get()
Request
💾03
Save
store()
Persist
🔒04
HTTPS
secure context
Security
🚪05
Logout
preventSilentAccess
Session
❓ Frequently Asked Questions
It is a read-only Navigator property that returns a CredentialsContainer for the current document — the entry point to the Credential Management API for requesting, storing, and managing sign-in credentials.
No. MDN marks it Baseline Widely available (since about September 2019). It is not Deprecated, Experimental, or Non-standard. It does require a secure context (HTTPS / localhost).
MDN’s pattern: if ("credentials" in navigator) { /* use CredentialsContainer */ } else { /* classic sign-in */ }.
Common methods include get() to retrieve credentials, store() to save them, create() to build credential objects, and preventSilentAccess() to stop automatic silent sign-in after logout.
Yes. The API is available only in secure contexts in supporting browsers.
No. The property is read-only. You call methods on the returned CredentialsContainer object.
Did you know?
MDN highlights that CredentialsContainer is also useful for feature detection — checking "credentials" in navigator tells you whether to offer the modern credential flow or stick to a classic form.