Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
The FederatedCredential() constructor creates a new FederatedCredential object. In supporting browsers, an instance of this class may be passed the credential received from the init object for global fetch().
new FederatedCredential(data)dataA FederatedCredentialInit object. An object with the following properties:
name OptionalA string representing the credential username.
iconURL OptionalA string representing the URL of an icon or avatar to be associated with the credential.
originA string representing the credential's origin. FederatedCredential objects are origin-bound, so they will only be usable on the origin specified here.
providerA string which identifies the credentials' federated identity provider, specified as the origin that the provider uses to sign users in (for example "https://www.facebook.com" or "https://accounts.google.com").
protocol OptionalA string representing the protocol of the credentials' federated identity provider (for example, "openidconnect").
const credData = {
id: "1234",
name: "Serpentina",
origin: "https://example.org",
protocol: "openidconnect",
provider: "https://provider.example.org",
};
const fedCred = new FederatedCredential(credData);
// Store it
navigator.credentials.store(fedCred).then(() => {
// Do something else
});