--- url: "https://web.dev/articles/security-credential-management" titulek: "The Credential Management API | Articles | web.dev" h1: "The Credential Management API Stay organized with collections Save and categorize content based on your preferences." popis: "" jazyk: "en" kanonicka: "https://web.dev/articles/security-credential-management" drobecky: ["Articles", "The Credential Management API"] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-13 23:12:55" znaku: 4206 slov: 510 kodovani: "iso-8859-2" sha256: "b0f8333ea4e7517b806ac41f01353422c140a4e5a17b3034015ec1ca137b1a8d" --- The Credential Management API Stay organized with collections Save and categorize content based on your preferences. Eiji Kitamura Meggin Kearney The [Credential Management API](https://www.w3.org/TR/credential-management/) is a standards-based browser API that provides a programmatic interface between the site and the browser for seamless sign-in across devices. The Credential Management API: **Removes friction from sign-in flows** - Users can be automatically signed back into a site even if their session has expired or they saved credentials on another device. **Allows one tap sign in with account chooser** - Users can choose an account in a native account chooser. **Stores credentials** - Your application can store either a username and password combination or even federated account details. These credentials can be synced across devices by the browser. Want to see it in action? Try the [Credential Management API Demo](https://credential-management-sample.appspot.com) and take a look at the [code](https://github.com/GoogleChrome/credential-management-sample). Check Credential Management API browser support Browser Support 51 18 60 13 [Source](https://developer.mozilla.org/docs/Web/API/Credential) Before using the Credential Management API, first check if `PasswordCredential` or `FederatedCredential` is supported. `if (window.PasswordCredential || window.FederatedCredential) { // Call navigator.credentials.get() to retrieve stored // PasswordCredentials or FederatedCredentials. }` Sign in user To sign in the user, retrieve the credentials from the browser's password manager and use them to log in the user. For example: When a user lands on your site and they are not signed in, call [`navigator.credentials.get()`](https://developer.mozilla.org/docs/Web/API/CredentialsContainer/get). Use the retrieved credentials to sign in the user. Update the UI to indicate the user has been signed in. Learn more in [Sign In Users](/articles/security-credential-management-retrieve-credentials#auto_sign-in). Save or update user credentials If the user signed in with a federated identity provider such as Google Sign-In, Facebook, GitHub: After the user successfully signs in or creates an account, create the [`FederatedCredential`](https://developer.mozilla.org/docs/Web/API/FederatedCredential) with the user's email address as the ID and specify the identity provider with `FederatedCredentials.provider`. Save the credential object using [`navigator.credentials.store()`](https://developer.mozilla.org/docs/Web/API/CredentialsContainer/store). Learn more in [Sign In Users](/articles/security-credential-management-retrieve-credentials#federated_login). If the user signed in with a username and password: After the user successfully signs in or creates an account, create the [`PasswordCredential`](https://developer.mozilla.org/docs/Web/API/PasswordCredential) with the user ID and the password. Save the credential object using [`navigator.credentials.store()`](https://developer.mozilla.org/docs/Web/API/CredentialsContainer/store). Learn more in [Save Credentials from Forms](/articles/security-credential-management-save-forms). Sign out When the user signs out, call [`navigator.credentials.preventSilentAccess()`](https://developer.mozilla.org/en-US/docs/Web/API/CredentialsContainer/preventSilentAccess) to prevent the user from being automatically signed back in. Disabling auto-sign-in also enables users to switch between accounts easily, for example, between work and personal accounts, or between accounts on shared devices, without having to re-enter their sign-in information. Learn more in [Sign out](/articles/security-credential-management-retrieve-credentials#sign-out). Feedback Except as otherwise noted, the content of this page is licensed under the [Creative Commons Attribution 4.0 License](https://creativecommons.org/licenses/by/4.0/), and code samples are licensed under the [Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0). For details, see the [Google Developers Site Policies](https://developers.google.com/site-policies). Java is a registered trademark of Oracle and/or its affiliates. Last updated 2016-11-08 UTC.