Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. IdentityCredential

IdentityCredential

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Experimental:This is anexperimental technology
Check theBrowser compatibility table carefully before using this in production.

Secure context: This feature is available only insecure contexts (HTTPS), in some or allsupporting browsers.

TheIdentityCredential interface of theFederated Credential Management API (FedCM) represents a user identity credential arising from a successful federated sign-in.

A successfulnavigator.credentials.get() call that includes anidentity option fulfills with anIdentityCredential instance.

Credential IdentityCredential

Instance properties

Inherits properties from its ancestor,Credential.

IdentityCredential.configURLRead onlyExperimental

A string specifying theconfig file URL of theIdP used for sign-in.

IdentityCredential.isAutoSelectedRead onlyExperimental

A boolean value that indicates whether the federated sign-in was carried out usingauto-reauthentication (i.e., without user mediation) or not.

IdentityCredential.tokenExperimental

Returns the token used to validate the associated sign-in.

Static methods

IdentityCredential.disconnect()Experimental

Disconnects the federated sign-in account used to obtain the credential.

Examples

Basic federated sign-in

Relying parties (RPs) can callnavigator.credentials.get() with theidentity option to make a request for users to sign in to the RP via an identity provider (IdP), using identity federation. A typical request would look like this:

js
async function signIn() {  const identityCredential = await navigator.credentials.get({    identity: {      providers: [        {          configURL: "https://accounts.idp.example/config.json",          clientId: "********",          nonce: "******",        },      ],    },  });}

If successful, this call will fulfill with anIdentityCredential instance. From this, you could return theIdentityCredential.token value, for example:

js
console.log(identityCredential.token);

Check outFederated Credential Management API (FedCM) for more details on how this works. This call will start off the sign-in flow described inFedCM sign-in flow.

Specifications

Specification
Federated Credential Management API
# browser-api-identity-credential-interface

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp