W3cubDocs

/Web APIs

IdentityProvider

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 IdentityProvider interface of the Federated Credential Management (FedCM) API represents an IdP 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

>

Basic IdentityProvider.getUserInfo() usage

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

// Iframe displaying a page from the https://idp.example origin
const 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

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Opera Safari Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet WebView Android WebView on iOS
IdentityProvider 116 116 No 102 No 116 No 78 No 24.0 No No
close_static 120 120 No 106 No 120 No 80 No 25.0 No No
getUserInfo_static 116 116 No 102 No 116 No 78 No 24.0 No No
resolve_static 132 132 No 117 No 132 No 87 No No No No

See also

© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/IdentityProvider