Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. IdentityProvider

IdentityProvider

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.

TheIdentityProvider interface of theFederated Credential Management (FedCM) API represents anIdP and provides access to related information and functionality.

Static methods

close()Experimental

Provides a manual signal to the browser that an IdP sign-in flow is finished. This is needed to, for example, close the IdP sign-in dialog when sign-in is completely finished and the IdP has finished collecting data from the user.

getUserInfo()Experimental

Returns information about a previously-signed in user on their return to an IdP, which can be used to provide a personalized welcome message and sign-in button.

Examples

BasicIdentityProvider.getUserInfo() usage

The following example shows how thegetUserInfo() method can be used to return information on a previously-signed in user from a specific IdP.

js
// Iframe displaying a page from the https://idp.example originconst userInfo = await IdentityProvider.getUserInfo({  configURL: "https://idp.example/fedcm.json",  clientId: "client1234",});// IdentityProvider.getUserInfo() returns an array of user information.if (userInfo.length > 0) {  // Returning accounts should be first, so the first account received  // is guaranteed to be a returning account  const name = userInfo[0].name;  const givenName = userInfo[0].given_name;  const displayName = givenName || name;  const picture = userInfo[0].picture;  const email = userInfo[0].email;  // …  // Render a personalized sign-in button using the information returned above}

Specifications

Specification
Federated Credential Management API
# browser-api-identity-provider-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